There is a python script i'm working on which processes an Image and converts and saves it from a GIF image into a TIFF format with extension ".tif"...
The script works fine and even gives me the proper output..
However, when i convert it into an exe using Py2exe(even tried Cx-Freeze) it is unable to save the processed image in TIFF format... it throws the following error:
File "PIL\Image.pyc", line 1423, in save KeyError: '.tif'
the code for saving the image looks like this..
im_orig = Image.open(path1) big = im_orig.resize((116, 56), Image.NEAREST) ext = ".tif" new=path.replace('.','') newpath=new+"input-NEAREST"+ext newimage=big.save(newpath)
I even tried changing the above code as follows to avoid the Key Error
im_orig = Image.open(path1) big = im_orig.resize((116, 56), Image.NEAREST) new=path.replace('.','') newpath=new+"input-NEAREST.tif" newimage=big.save(newpath, "TIFF" )
The changed code once again works perfectly fine when i run it as a script ,
but throws error when i run the script as an executable !
The error i get is:
\PIL\Image.py", line 1429, in save save_handler = SAVE[string.upper(format)] # unknown format KeyError: 'TIFF'
apparently the error is supposed to be in this line:
newimage=big.save(newpath, "TIFF" )
Will really appreciate any help or guidance in solving this problem.