[SciPy-user] fromimage returns instance instead of numpy array

Stefan van der Walt stefan@sun.ac...
Wed Oct 10 13:33:00 CDT 2007


Hi Zachary

On Tue, Oct 09, 2007 at 11:19:13PM -0400, Zachary Pincus wrote:
> > PIL 1.1.6 is still broken to some extent.  I sent a patch to the Image
> > SIG:
> >
> > http://mail.python.org/pipermail/image-sig/2007-August/004570.html
> >
> > Unfortunately, there was no reaction.
> 
> I sent a very similar patch a while ago, and got similar results  
> (i.e. no response).
> 
> Moreover, the PIL is extremely inconsistent about its handling of 16- 
> bit integer images (important for many scientific uses), and has  
> various byte-swapping bugs for these on little-endian architectures.  
> There was also little interest in my patches about those issues...
> 
> I have for a while been toying with taking the image format parsers  
> (all in pure python) from the PIL and hooking that up to numpy for  
> actually unpacking the bits from the file. (Right now, the PIL uses  
> some custom and occasionally questionable C code to do this.) I've  
> made no progress, but I think it would be possible to do so with not  
> too much fuss. Would there be any interest in something like this?
> 
> My current solution is a fork of PIL that I made, which rips out  
> basically everything except image IO, and for which I fixed the 16- 
> bit image problems and drastically beefed up the numpy compatibility.  
> I'd be happy to send this to anyone who desires, or if there was a  
> specific clamor, make it a scikit or something. Is there any interest  
> regarding that either?

Currently, we have 3 systems involved here:

- scipy.misc.pilutil
- scipy.ndimage
- PIL

Jarrod Millman mentioned that they will soon start a rewrite/major
refactoring of ndimage.  I think we should merge all the image
processing and I/O abilities currently available in scipy into the new
package.  Ndimage was written before numpy reached 1.0, and duplicates
a lot of functionality that can now be written in Python.  Converting
the code from C to Python will certainly lessen the burden on
developers.

I hope that your code finds it way into the new ndimage (it may help
if you make the patches available now, already -- or if you write a
wiki page about the deficiencies you noticed).  I'm keeping my eyes
open, and hope to see some more messages on the topic from the nipy
guys.

Cheers
Stéfan


More information about the SciPy-user mailing list