[Image-SIG] Handling "image file is not of type 17" errors...

Alec Bennett whatyoulookin at yahoo.com
Mon Nov 26 01:34:01 CET 2007


Indeed it does, I'm sure you're right.

For anyone else coming down this path, here's how I
handled the situation. None too graceful but so far so
good:

try:
    w, h = im.size # check integrity of image file   
im.save("whatever.jpg", quality=100)
except:
    print "Whoops, bad file"

What's interesting is this code (without determining
the image dimensions) wouldn't throw an exception,
just that annoying popup error:

try:
    im.save("whatever.jpg", quality=100)
except:
    print "Whoops, bad file"








      ____________________________________________________________________________________
Be a better pen pal. 
Text or chat with friends inside Yahoo! Mail. See how.  http://overview.mail.yahoo.com/


More information about the Image-SIG mailing list