Advertisement
Guest User

Make OpenXCom Mod Mac Compatible

a guest
Oct 29th, 2014
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 18.15 KB | None | 0 0
  1. from PIL import Image
  2. import sys,os
  3. from subprocess import Popen, PIPE
  4. import fileinput
  5. if sys.version_info < (3, 0):  
  6.     import StringIO
  7.     bread= StringIO.StringIO
  8. else:
  9.     import io
  10.     bread= io.BytesIO
  11.  
  12.  
  13. def convert_gif_to_png(root,file):
  14.     nf = file[0:-4]+".png" #set the new file name
  15.     im=Image.open(root+os.sep+file)
  16.     im.save(root+os.sep+nf,optimize=False,transparency=0)
  17.     os.remove(root+os.sep+file) #delete the original gif
  18. ".gif", ".png"), end="")
  19.  
  20. for args in sys.argv[1:]:
  21.     for root, dirs, files in os.walk(args):
  22.         for f in files:
  23.             if f.lower().endswith(".gif"):
  24.                 newfile = convert_gif_to_png(root,f)
  25.                 bgfixed = convert_trans_to_color(root,newfile)
  26.             elif f.lower().endswith(".png"):
  27.                 bgfixed = convert_trans_to_color(root,f)
  28.             elif f.lower().endswith(".rul"):
  29.                 convert_img_in_rul(root,f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement