many text work and scripts

This commit is contained in:
sShemet
2025-12-08 20:28:56 +05:00
parent 37dca7ee15
commit c09c3db56c
697 changed files with 12308 additions and 9392 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

View File

@@ -0,0 +1 @@
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,75 @@
from PIL import Image
import sys
import os
def split_and_convert(img_path, tile_size=(64, 256)):
# Открываем изображение
img = Image.open(img_path)
width, height = img.size
# Получаем имя файла без расширения
base_name = os.path.splitext(os.path.basename(img_path))[0]
counter = 0
for i in range(0, width, tile_size[0]):
for j in range(0, height, tile_size[1]):
box = (i, j, i+tile_size[0], j+tile_size[1])
tile = img.crop(box)
# Конвертируем в 256 цветов
tile = tile.convert('P', palette=Image.Palette.ADAPTIVE, colors=256)
# Сохраняем тайл с чётным индексом
tile.save(f'{base_name}_{counter:02d}_00_00.png', optimize=True)
# Извлекаем палитру
palette = tile.getpalette()
if palette:
# Создаём изображение палитры 256x1
# Каждый пиксель - один цвет из палитры
palette_rgb = []
for k in range(0, len(palette), 3):
r, g, b = palette[k], palette[k+1], palette[k+2]
palette_rgb.append((r, g, b))
# Обрезаем до 256 цветов (на всякий случай)
palette_rgb = palette_rgb[:256]
# Создаём изображение палитры 256x10 (можно сделать 256x1, но так нагляднее)
palette_img = Image.new('RGB', (256, 1))
# Заполняем каждый столбец своим цветом
for x in range(256):
color = palette_rgb[x] if x < len(palette_rgb) else (0, 0, 0)
for y in range(1):
palette_img.putpixel((x, y), color)
# Сохраняем палитру с нечётным индексом как 16-bit PNG
palette_img.save(
f'{base_name}_{counter+1:02d}_00_00.png',
optimize=True,
bits=16 # 16-битное сохранение
)
counter += 2
def main():
# Проверяем аргументы командной строки
if len(sys.argv) < 2:
print("Использование: python script.py <input_image>")
print("Пример: python script.py TEST.png")
sys.exit(1)
input_image = sys.argv[1]
# Проверяем существование файла
if not os.path.exists(input_image):
print(f"Ошибка: Файл '{input_image}' не найден")
sys.exit(1)
# Запускаем обработку
split_and_convert(input_image)
if __name__ == "__main__":
main()

Binary file not shown.

Binary file not shown.

Binary file not shown.