[Matplotlib-users] imread() and binary PNGs

2008-10-23 Thread David Warde-Farley
Howdy, I noticed that MPL's imread() command, when applied to binary (1-bit grayscale) PNGs does some serious mangling. Anyone know what's going on, or is it just that only RGBA PNG's are supported? Thanks, David - Thi

Re: [Matplotlib-users] imread() and binary PNGs

2008-10-23 Thread Michael Droettboom
I'm not aware of that problem. It should convert any PNG implicitly to our native RGBA format. Can you provide a PNG file that illustrates the breakage? Mike David Warde-Farley wrote: > Howdy, > > I noticed that MPL's imread() command, when applied to binary (1-bit > grayscale) PNGs does so

Re: [Matplotlib-users] imread() and binary PNGs

2008-10-23 Thread David Warde-Farley
On 23-Oct-08, at 8:50 AM, Michael Droettboom wrote: > I'm not aware of that problem. It should convert any PNG implicitly > to our native RGBA format. Can you provide a PNG file that > illustrates the breakage? Sure; see http://morrislab.med.utoronto.ca/~dwf/bin.png In [12]: x = imread('b

Re: [Matplotlib-users] imread() and binary PNGs

2008-10-23 Thread David Warde-Farley
On 23-Oct-08, at 4:43 PM, David Warde-Farley wrote: > Sure; see http://morrislab.med.utoronto.ca/~dwf/bin.png > > In [12]: x = imread('bin.png'); imshow(x) > > produces a colourful plot that bears no resemblance to the original. Two other things: a) PIL can read in these without incide

Re: [Matplotlib-users] imread() and binary PNGs

2008-10-23 Thread Joshua Lippai
David, After playing around with this file and the various elements of image.py, I've determined that the pil_to_array function in matplotlib.image works just fine, so the place where the problem is introduced in imread is the read_png function in matplotlib._png. So a simpler work-around for this

Re: [Matplotlib-users] imread() and binary PNGs

2008-10-23 Thread Joshua Lippai
Actually, I should clarify something. The way imread is set up, since the file is a PNG, it never goes through pil_to_array at all in standard imread and instead gets passed to the handler _png.read_png. Anyway, I'll take a closer peek inside the _png.cpp file once I get some more time. Josh On T