Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- import sys,os
- from subprocess import Popen, PIPE
- import fileinput
- if sys.version_info < (3, 0):
- import StringIO
- bread= StringIO.StringIO
- else:
- import io
- bread= io.BytesIO
- def convert_gif_to_png(root,file):
- nf = file[0:-4]+".png" #set the new file name
- im=Image.open(root+os.sep+file)
- im.save(root+os.sep+nf,optimize=False,transparency=0)
- os.remove(root+os.sep+file) #delete the original gif
- ".gif", ".png"), end="")
- for args in sys.argv[1:]:
- for root, dirs, files in os.walk(args):
- for f in files:
- if f.lower().endswith(".gif"):
- newfile = convert_gif_to_png(root,f)
- bgfixed = convert_trans_to_color(root,newfile)
- elif f.lower().endswith(".png"):
- bgfixed = convert_trans_to_color(root,f)
- elif f.lower().endswith(".rul"):
- convert_img_in_rul(root,f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement