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

Comments

Projects
None yet
3 participants
@tdsmith
Copy link

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

This comment has been minimized.

Copy link
Member

commented Jul 9, 2013

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

This comment has been minimized.

Copy link
Member

commented Sep 27, 2013

Anything for 2.2.0 here @wiredfool ?

@aclark4life

This comment has been minimized.

Copy link
Member

commented Sep 28, 2013

Meh, this can wait for 2.3.0 or Future IMHO

@wiredfool

This comment has been minimized.

Copy link
Member

commented Sep 30, 2013

Fixed by #347.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.