[Sw] Update holo_convertor script.

This commit is contained in:
稚晖 2021-03-03 23:09:50 +08:00
parent 0847129aca
commit 4980e55b0f
4 changed files with 11 additions and 10 deletions

View File

@ -127,7 +127,7 @@ class Convertor(object):
self.img = self.img.convert(mode="P", colors=palette_size)
real_palette_size = len(self.img.getcolors()) # The real number of colors in the image's palette
real_palette = self.img.getpalette()
self.img.show()
# self.img.show()
for i in range(palette_size):
if i < real_palette_size:
c = getColorFromPalette(real_palette, i)

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

View File

@ -1,14 +1,15 @@
import os, sys
import os.path, sys, time
from convertor.core import Convertor
if __name__ == '__main__':
if len(sys.argv) == 2:
INPUT_FILE = sys.argv[1]
else:
print("usage:\n\t python " + sys.argv[0] + " input_file.jpg")
if len(sys.argv) < 2:
print("用法: 把要转换的 JPG/PNG/BMP 文件拖到.exe图标上即可")
time.sleep(3)
sys.exit(0)
c = Convertor(INPUT_FILE)
c.get_bin_file()
c.get_c_code_file()
for i, img_path in enumerate(sys.argv[1:]):
print("正在转换图片{} ...".format(os.path.basename(img_path)))
c = Convertor(img_path)
c.get_bin_file()
# c.get_c_code_file()