Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16-bit TIFF files cannot be converted to array #273

Closed
tdsmith opened this issue Jul 8, 2013 · 4 comments
Closed

16-bit TIFF files cannot be converted to array #273

tdsmith opened this issue Jul 8, 2013 · 4 comments
Labels
Bug Any unexpected behavior, until confirmed feature.
Milestone

Comments

@tdsmith
Copy link

tdsmith commented Jul 8, 2013

Example data file: https://dl.dropboxusercontent.com/u/3720/junk/12bit.tif (a 16-bit TIFF container with pixel values spanning a 12-bit range, which is common in scientific imaging)

Opening the file with Image.open works:

>>> im, im.mode
(<PIL.TiffImagePlugin.TiffImageFile image mode=I;16 size=1344x1024 at 0x1074A2518>, 'I;16')

Attempting to convert the Image object to an array just encapsulates it:

>>> np.array(im)
array(<PIL.TiffImagePlugin.TiffImageFile image mode=I;16 size=1344x1024 at 0x1074A2518>, dtype=object)

This is a 1x1 array containing an Image object. I was expecting to have a 1344x1024 array containing 16-bit integer values.

@wiredfool
Copy link
Member

Perhaps related, I seem to remember that 1 bit images have issues getting turned into bit nd arrays. The workaround I hit at the time was to convert them into 8 bit ndarrays with values 0 or 255.

@aclark4life
Copy link
Member

Anything for 2.2.0 here @wiredfool ?

@aclark4life
Copy link
Member

Meh, this can wait for 2.3.0 or Future IMHO

@wiredfool
Copy link
Member

Fixed by #347.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Any unexpected behavior, until confirmed feature.
Projects
None yet
Development

No branches or pull requests

3 participants