[PYTHON IMAGE-SIG] Determining which formats are "loadable"

Fredrik Lundh fredrik_lundh@ivab.se
Tue, 11 Mar 1997 17:07:59 +0100


>  I'd like to be able to check to see if an image format is loadable
> before performing any operations on it, mainly so I can check for
> alternative formats.  If I have a MIME type, I can use Image.MIME
> dictionary to get the format tag and then use Image.OPEN to determine
> that a factory exists for the format, but that doesn't tell me that I
> can actually load the data.
>   Is there a way to determine whether an image format is loadable
> before I actually retrieve the image data?

Nope.  Actually, PIL 0.2b4 can read all formats for which there are
factories (MPEG being the only exception, I think); but it cannot read
all variants of every format...  So as far as you can tell from the
MIME type, if there's a factory, PIL might be able to handle the file,
and you must download at least a part of it to be able to tell for
sure.

I have some ideas on how to minimize the amount of data you actually
have to download (varies greatly between formats), but they will most
likely not make their way into 0.2.  But maybe later.

Cheers	/F (http://hem1.passagen.se/eff)

_______________
IMAGE-SIG - SIG on Image Processing with Python

send messages to: image-sig@python.org
administrivia to: image-sig-request@python.org
_______________