Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Images with bit depth > 8 (depth sensor or medical images) #239

Closed
dibenedetto opened this issue Sep 9, 2019 · 5 comments · Fixed by #242
Closed

Images with bit depth > 8 (depth sensor or medical images) #239

dibenedetto opened this issue Sep 9, 2019 · 5 comments · Fixed by #242
Labels
image Related to images

Comments

@dibenedetto
Copy link

grayscale images with bit depth > 8 (think about depth sensor or medical images) are automatically converted to 8 bit instead of keeping the most adequate representation:

if color_mode == 'grayscale':
if img.mode != 'L':
img = img.convert('L')`

PIL images with mode == 'I' (capital i) are actually 32bit integer images, and should not be shrinked down to 8 bit, thus keeping all the information.

@dibenedetto dibenedetto added the image Related to images label Sep 9, 2019
@rragundez
Copy link
Collaborator

I believe you have a point here. Can you provide me with one of these images so I can perform some tests? thanks!

@rragundez
Copy link
Collaborator

wow! how has this not been addressed before :s apologies

Selection_029

I'll make some more tests and make the PR promptly. Thanks @dibenedetto

@dibenedetto
Copy link
Author

dibenedetto commented Sep 18, 2019 via email

@rragundez
Copy link
Collaborator

@dibenedetto please have a look at #242. Any feedback from a user perspective would be appreciated. You can also try the code out from that branch.

@dibenedetto
Copy link
Author

dibenedetto commented Sep 23, 2019 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
image Related to images
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants