[Numpy-discussion] import 16-bit tiff - byte-order problem?
David Warde-Farley
dwf at cs.toronto.edu
Fri Nov 7 04:23:19 EST 2008
On 6-Nov-08, at 11:15 PM, Angus McMorland wrote:
> 2008/11/6 Robert Kern <robert.kern at gmail.com>:
>> On Thu, Nov 6, 2008 at 21:54, Angus McMorland <amcmorl at gmail.com>
>> wrote:
>>> Hi all,
>>>
>>> I'm trying to import a 16-bit tiff image into a numpy array. I have
>>> found, using google, suggestions to do the following:
>>>
>>> After starting with:
>>> i = Image.open('16bitGreyscaleImage.tif')
>>>
>>> Stéfan van der Walt suggested:
>>> a = np.array(i.getdata()).reshape(i.size) # a 1d numpy array
As an aside, if you have matplotlib installed, you might be able to
sidestep this problem completely with matplotlib.image.pil_to_array.
Cheers,
David
More information about the NumPy-Discussion
mailing list