FreeImagePy creating thumbnails from TIFF

geskerrett at geskerrett at
Mon Oct 23 18:06:46 CEST 2006

I a trying to create a series of thumbnail images from a multpage TIFF
file.  The sample code is below.  When it executes, we get the
following error;
FreeImagePy.constants.FreeImagePy_ColorWrong: 'Wrong color 1 in
function: FreeImage_MakeThumbnail. I can use: (8, 24, 32)'

Any suggestions?

fname = "01-PJ2306.tif"
img = FIPY.Image()

#NOTE: the follow method results"
#getFormat: ((18, 0), ('TIFF', 'MINISWHITE'), (200, 200))
#getColorUsed: 2
#getNumPages: 8

for pg in range(img.getNumPages()):
    print 'page;',pg
    bmp = FIPY.Image(),300),fileType=FIF_TIFF)
    bmp.thumbnail(300,convert=True)"first_thumb_"+str(pg), FIF_PNG)
    del bmp

Using the above "img" we were able to successfully create the seperate
pages as PNG files in a working directory, however, our goal is to use
to display a series of thumbnails in a wxpython application.  The app
will stored references back to the orginal document with the
correspondng page number.   Essentially we want to avoid having to
"cleanup" a working directory of the PNG pages.
... but if someone has suggestions on this, we are interested too !

Thanks in avance.

More information about the Python-list mailing list