Fixed GIF handling with PIL

svn: r500
This commit is contained in:
Don Allingham 2001-10-20 04:02:01 +00:00
parent c5153af1c6
commit ec6a3e74ac

View File

@ -115,16 +115,16 @@ def mk_thumb(source,dest,size):
GnomeErrorDialog(_("Could not create %s") % dir) GnomeErrorDialog(_("Could not create %s") % dir)
return return
print source[-3:] if no_pil:
if no_pil or source[-4:] == ".gif":
cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,size,size,source,dest) cmd = "%s -geometry %dx%d '%s' '%s'" % (const.convert,size,size,source,dest)
print cmd
os.system(cmd) os.system(cmd)
else: else:
try: try:
im = PIL.Image.open(source) im = PIL.Image.open(source)
im.convert("RGB")
im.thumbnail((size,size)) im.thumbnail((size,size))
if im.mode != 'RGB':
im.draft('RGB',im.size)
im = im.convert("RGB")
im.save(dest,"JPEG") im.save(dest,"JPEG")
except: except:
pass pass