Created
September 23, 2016 01:45
-
-
Save ichimarusakura/836f262efe701ebcc9d55037204e5cc7 to your computer and use it in GitHub Desktop.
ForDeviceImageConvertor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import io,os,struct,codecs,glob,binascii | |
| from PIL import Image | |
| imgs = glob.iglob('slices//*.*') | |
| for img in imgs: | |
| fo_img = Image.open(img) | |
| filename = os.path.basename(img) | |
| basename, extname = os.path.splitext(filename) | |
| o_path = 'bmp//' | |
| if os.path.isdir(o_path) == False: | |
| os.mkdir(o_path) | |
| temp_img = Image.new('RGB', fo_img.size) | |
| temp_img.paste(fo_img, (0, 0)) | |
| print("coverted %s" % basename+extname) | |
| temp_img.save(o_path + basename + '.bmp','bmp',dpi=(72,72)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment