[Image-SIG] how to verify image file format - difficult !

Fredrik Lundh fredrik at pythonware.com
Thu Nov 8 22:18:52 CET 2007


Sebastian Haase wrote:

> Are these obscure constrains ("load() cannot be called sanely after
> verify()" ) still needed ?

open() sets things up for lazy loading; the actual loading/decoding is 
done when needed, or explicitly by load().

verify() just checks the file's internal checksums etc, where available; 
it doesn't guarantee anything, and a format drive is free to mess up the 
lazy loading state during verification (which is why it has to be used 
in a specific way).  there's hardly ever any reason to do both verify() 
and load() on a file; if the file cannot be loaded, load() will catch it.

> And is it really suggested to "load" the entire image first, just to
> tell if it's valid ?

to tell if a file really is possible to load into an image memory, you 
need to load it.

</F>



More information about the Image-SIG mailing list