Trying to get FreeImagePy to work.

Michele Petrazzo michele.petrazzo at TOGLIunipex.it
Thu Jun 1 12:42:50 EDT 2006


Iain King wrote:
>> Can you download the last svn version from sf.net? Otherwise I'll send
>> you the last sources privately.
>>
>> Bye,
>> Michele
> 

> I got the TortoiseSVN client though, and
> checked out your newest build, copied it over the top of
> site-packages/freeimagepy, updated my ctypes back to 0.9.9.6 (I'd
> regressed again), ran my program, and it worked.  Thanks!

This is a good news!

> Next question (and what I'm using FreeImagePy for):  I'm loading a pile
> of TIF's as thumbnails into a wx list control.  I load the image with
> FIPY, convert it to PIL, use PIL's antialiasing thumbnail function,
> then load it from there into wx.  

Why use PIL for it and not FIPY directly? You can use the image.size or 
the other methods for resize the image

> However, when I'm do the
> fipy.convertToPil(), it inverts the image?  

No, it not invert the image... It only return the image as is.

> I've inserted a
> fipy.invert() before the conversion as a temporary fix, but is there a
> reason for this?

If you are have a min-is-white image (fax ?) that isn't the standard,
you will have an "inverted" image, because PIl expect a min-is-black
image!

> relevant code:
> 
> def getHeaders(files):
> 	thumbs = []
> 	for f in files:
> 		print "Adding %s" % f
> 		fi = FIPY.Image(f)
> 		fi.setCurrentPage(0)
> 		fi.invert() #temp fix
> 		thumb = fi.convertToPil()
> 		thumb.thumbnail(THUMBNAIL_SIZE, Image.ANTIALIAS)
> 		thumbs.append((os.path.basename(f), pilToBitmap(thumb)))
> 	thumbs.sort()
> 	return thumbs

Just a question, why "thumbs.sort" ? Inside this list you have only
images!

P.s. you can use also fi.currentPage = 0 rather then
fi.setCurrentPage(0). Is think it look like better :)

> 
> Iain
> 
> p.s. thanks again
> 

:)

Michele



More information about the Python-list mailing list