mirror of
https://gitee.com/peng_zhihui/HoloCubic
synced 2025-11-04 21:19:40 +08:00
[Sw] Update holo_convertor script.
This commit is contained in:
parent
0847129aca
commit
4980e55b0f
Binary file not shown.
@ -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)
|
||||
|
||||
BIN
3.Software/ImageToHolo/convertor/icon.ico
Normal file
BIN
3.Software/ImageToHolo/convertor/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 306 KiB |
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user