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
