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 file than reading each bit into a bool array yourself would be to import Image (PIL) and matplotlib.image to call the pil_to_array function on an Image.open'd object directly:
import Image import matplotlib.image as image import pylab as p x = image.pil_to_array(Image.open('bin.png')); p.imshow(x); p.show() In the mean time, I'll see if the devel list has some better insight on the issue. Josh On Thu, Oct 23, 2008 at 1:52 PM, David Warde-Farley <[EMAIL PROTECTED]> wrote: > > 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 incident; my work around has been to > open with PIL and manually read each bit into a dtype=bool numpy array. > > b) I might add that what appears seems to be cyclic, making me think > that it's trying to read a few bytes for each pixel where in fact > there is only a single bit, and thus reading far less data than it's > expecting, and thus only has a few columns worth of pixels that is > somehow getting repeatedly referenced in the numpy array. This is all > just (mildly educated) guesswork though. > > David > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users