Re: memoryError in FpxImageUploadPlugin.py

Gábor Farkas <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
2011/4/16 Alec Bennett <[email protected]>:
>> i only care about JPG/PNG/GIF...
>> is there any way do a fileformat-whitelist?
>
> Seems almost too obvious to mention, but you could do something like:
> fname = "something.jpg"
> image_extensions = (".jpg", ".png", ".gif")
> extension = os.path.splitext(fname)[1].lower()
> if extension in image_extensions:
>     print "its an image!"
>     do_some_stuff(fname)

is PIL's image-format-detection purely filename-extension based?

i mean, what happens if i take the problematic file, and rename it
to have a jpeg-extension... will PIL not try the other file-format-plugins,
when jpeg fails?

gabor
_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.