[SciPy-User] FreeImage <-> numpy IO wrappers

Sebastian Haase seb.haase@gmail....
Tue Oct 19 06:31:39 CDT 2010

Hi Zach,

I finally got around to testing your image.py module.
Someone send me a 16-bit TIFF file made from Metamorph that PIL did
not open correctly.

Here are some comment and questions:

1) I would rename it to freeImage.py - or alike
2) Compiling freeimage from source went really well. No configure,
simple a "make" and it ran through. Except in my version
freeimage-3.14.1 I had to add "#include <string.h>" to file
ImathMatrix.h so that it would accept the use of memset(...)

3) you are changing the FreeImage convention of 0,0 being bottom-left
to 0,0 being top-left -- to make it more like "all other" image
software.   I actually come from UCSF where we used the MRC format
having 0,0 being left-bottom.  How strong do you feel about this ?

4) For the return numpy-array you explicitly call copy() -  I guess
this is needed because one has to call FreeImage's unload() , right ?

5) you define the array strides to have the pitch (that is, the line
width) last -- this is somewhat against the C-convention of having the
fast axis last. Obviously you did this, to get arrays with indices i,j
having x,y order rather than y,x -- how strong do you feel about this
? I accepted at some point that the fast (x) coordinate would be last
and thus always write coordinates as y,x.
(In 3D this becomes semi-naturally z,y,x  rather then z,x,y - BTW - )

Do you happen to have os-x binaries of libfreeimage.dylib ?

I'm looking forward to not having to use PIL anymore - thanks for your work.
- Sebastian

More information about the SciPy-User mailing list