FreeImagePy F.A.Q.

Q: Why?
A: I start this project when I needed a simple python library for manipulate
   some images/fax into my python fax client "hylapex" for hylafax server.
   All the projects present on the net have problems on TIFF G3/G4 compression
   or are too slow, so I create the bind to this fantastic library...

Q: How use it?
A: Simple load the FreeImagePy modules, instance the freeimage class and use it!
   FreeImagePy will search for the library on your system, an if I not find it, I'll raise
   an exception.

Q: What are the naming convention?
A: I wrap a lot of most used FreeImage functions with its internal name,
   without the "FreeImage_" prefix, so you can call any function with:
   FreeImage_Load -> instance.Load (All the library functions are uppercase)

Q: I receive the FreeImagePy.constants.FreeImagePy_LibraryNotFound exception
A: This happen because the FreeImagePy library cannot find the FreeImage library
   (.so, .dll) on the standards paths:
   windows: python_dir/lib/site-packages/FreeImagePy/FreeImage.dll
   linux:   /usr/lib/
   So, can you have in that path the library? If not, please call the freeimage
   python class and pass it the correct path:
   import FreeImagePy
   # windows:
   myLibIstance = FreeImagePy.freeimage('c:\\mylibs\\freeimage.dll')
   myLibIstance = FreeImagePy.freeimage('/home/user/mylibrary/')

Q: Have you added some functions?
A: Yes, I add some functions like: genericLoaded, loadAndSave, convertToMultipage
   and convertToSinglePage, etc... (All the internal functions are lowercase)

Q:Can I use FreeImagePy with numarray?
A: Yes! With the new functions getBuffer and loadFromBuffer (thanks to Lenard Lindstrom
    for Handle functions) you can talk with numarray

Q: There are some examples?
A: Execute the file into test subdirectory from terminal and see it's
   image output!

Q: Can I convert an Image to PIL?
A: Yes! Use convertToPil function.

Is it complete?
A: No. Some functions are not wrapped because are too complicate (for me)
   or I don't need that functions into my projects and I have no more time to work on.

Q: What are the functions not wrapped?
A: List:
   -- Too complicate (from me)
   all Memory I/O streams
   -- Not used
   all Tone mapping
   all ICC Profile
   all Compression
   some Helper
   some Metadata
   some Tags
   some Toolkit
   some Channel processing
Q: Can I help you?
A: Yes, of course... :). See into the the tools directory
   If you want to modify, add some bind, add some "internal" helper functions and/or
   find some bugs, please do it and send my your code!

Q: What are the differences from PIL?
A: I don't know very well PIL, but this is a what I saw:

FI =  FreeImage, FIPY = FreeImagePy

First is to work well with the TIFF g3/g4 without problem, that is the
first reason that push me to create the wrapper, because in my fax
client, I must use this compression (of course), and second (with the
same importance) is that, in the same program, I use the multipage
"tiff+resize+set correct DPI" function for create a "standard" fax page.

The image type and its depth supported by FI library, so by FIPY (I only
wrap the functions, not the code), is largest because it support (from FI site) :
"Support for High Dynamic Range images. FI supports RGB float images as
well a 48-bit HDR images and provides tone mapping operators to convert
these images to 24-bit LDR images."

FI (FIPY) support Metadata information: "Comments, Exif (including GPS
and maker notes), IPTC, Adobe XMP and GeoTIFF metadata models."

With FI you don't need to worry to what type of image "modes" you are
working on, example: PIL:
im ="test.tif")"out.png", "PNG")
---->IOError: cannot write mode CMYK as PNG

Ok, if a developer working on the image he has to know its type, but for
people like me that not know what is a CMYK mode  :) , it's very difficult
to find a immediate solution for resolve this problem. With FIPY this
not happen, because the library make all the conversion for me!

But, in the other hand, PIL support types like pdf, font (ttf, ...) that
FI not support.
PIL is more "pythonic", so it not need methods like Initialize,
DeInitialize, Unload (image), when the developer have to do something on
a image, for example, resize the image, with PIL you can do
image.resize, with FIPY you must use the FIPY instance and do
FIPY.Resize(image, ...)
With PIL you don't need to work with pointers or other strange and
"magic" (for me  :)  ) C/C++ code, but in FIPY yes, like you can read on
the Palette and Invert functions.

The speed in my tries is the same (more or less), or better in same
tests with a big (16 MB) tiff image (without compression) 24 color,
where I load, rotate, rescale with highest quality, save all the image
to png format, seem that PIL time is lesser than FI dll + FIPY to about
0,05 or 0,1 seconds, so I think that is not a real difference.

I think that the documentation is better in FI. It has a simple pdf that
explain all the features with same examples. For me the PIL
documentation is not so simple that the other.