473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

FreeImagePy creating thumbnails from TIFF

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()
img.load(fname)

#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()
bmp.new((300,300),fileType=FIF_TIFF)
bmp.setBitmap(img)
bmp.thumbnail(300,convert=True)
bmp.save("first_thumb_"+str(pg), FIF_PNG)
img.setCurrentPage(pg+1)
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.

Oct 23 '06 #1
1 1804
ge********@hotmail.com wrote:
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?
Found a bug!
Change, into the funct_list, at line 119,
('FreeImage_MakeThumbnail', '@12', (CO.COL_8, CO.COL_24, CO.COL_32) ),
to
('FreeImage_MakeThumbnail', '@12', CO.COL_1TO32 ),
and it'll work.
Or update to the new svn version (r21), that adds the
__iter__ method for the Image class. Now you can do this:

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

for bmp in img:
new_img = bmp.thumbnail(300)

Bye,
Michele
Oct 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John | last post by:
I am trying to create thumbnails from 2500 pictures. But I always get a Maximum execution time of 30 seconds exceeded" at the statement with the method with imagejpeg or imagedestroy after...
4
by: sepgy | last post by:
Can anyone help me to use a python to create an HTML photo gallery generator. When it's finished, it will be able find all the picture files (i.e. .jpg, .gif. .png files) in any given folder on the...
4
by: Phil | last post by:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and made into a TIF file and placed on the client (could be in temp internet dir). The reason we need it in TIF format is...
7
by: Bob Day | last post by:
Using VS 2003... Is there a way to create a tif file on the fly to be faxed? I need a simply cover page (simple logo, to/from, etc.) and am currently doing it in text only, but that doesn't...
1
by: David Lozzi | last post by:
Hello, I'm wondering whats the best method to use for displaying several photos' thumbnails. One method I know is to dynamically resize the photo at the time the page is loaded. What does this...
13
by: Iain King | last post by:
I've installed ctypes and FreeImagePy. When I do this: >>> import FreeImagePy >>> f = FreeImagePy.Image() I get: find Traceback (most recent call last): File "<stdin>", line 1, in ? File...
0
by: Stedak | last post by:
We are scanning images and saving them as TIFF's in a database. We are running into some problems because in the creation of the TIFF the EncoderValue.CompressionLZW is ignored. It does not seem to...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I have an WinForms application, and I am currently trying to load a TIFF file that contains about 70, 90 o more frames and show it in my form like thumbnails. Once I have the...
3
by: GiJeet | last post by:
Hello, we have an app that scans documents into TIFF format and we need to transfer them over the internet. If anyone knows of a SDK we can use that can compress TIFFs on the fly or even if it can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.