Trying to get FreeImagePy to work.

Iain King iainking at gmail.com
Fri Jun 2 04:10:36 EDT 2006


Iain King wrote:
> Michele Petrazzo wrote:
> > Iain King wrote:
> > > 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!
> >
>
>
> This is probably what is happening.  I'll upload one of the images
> tomorrow, and you can check it out to make sure.
>
>
> > > 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!
>
> Ah, look closer!  It's a list of tuples:  (filename, image)
> I'll try out FIPY's resizing tomorrow too.  OTOH, I have functions to
> convert between PIL and wxPython, and functions to convert betweem PIL
> and FIPY, but I don't see a function to convert FIPY to wxPython?
> 

Image at:  http://www.snakebomb.com/misc/example.tif

Iain




More information about the Python-list mailing list