[Numpy-discussion] Help with bit arrays

Paul Hobson pmhobson at gmail.com
Fri Apr 29 12:06:24 EDT 2016


Does using pyplot.imgread work?

On Fri, Apr 29, 2016 at 8:27 AM, Henrique Almeida <hdante.lnls at gmail.com>
wrote:

>  Any help with this problem ?
>
> 2016-04-27 11:35 GMT-03:00 Henrique Almeida <hdante.lnls at gmail.com>:
> >  Hello, what's the current status on numpy for loading bit-arrays ?
> >
> > I'm currently unable to correctly load black and white (1-bit) TIFF
> > images. Code example follows:
> >
> > from PIL import Image
> > import numpy
> > from matplotlib import pyplot
> >
> > img = Image.open('oi-00.tiff')
> > a = numpy.array(img)
> >
> > ^ does not work for 1-bit TIFF images
> >
> > PIL source shows that it incorrectly uses typestr == '|b1'. I tried to
> > change this to '|t1', but I get :
> >
> > TypeError: data type "|t1" not understood
> >
> > My goal is to make the above code to work for black and white TIFF
> > images the same way it works for grayscale images. Any help ?
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> https://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20160429/38a4a08d/attachment.html>


More information about the NumPy-Discussion mailing list