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

Clipping on 16 bit grayscale tiff conversion to JPEG #1108

Closed
dbrunton opened this issue Feb 10, 2015 · 4 comments
Closed

Clipping on 16 bit grayscale tiff conversion to JPEG #1108

dbrunton opened this issue Feb 10, 2015 · 4 comments
Labels
Bug Any unexpected behavior, until confirmed feature.

Comments

@dbrunton
Copy link

convert() (and consequently pilconvert.py) seems to clip 16 bit grayscale tiffs when they convert to jpeg. This seems to persist no matter what order of conversions is applied. The two attached images were made with pilconvert.py -g and -r. Unfortunately GitHub won't let me upload a Tiff, but I'm happy to send the original via email if that would help.
test3-g
test3-r

@wiredfool
Copy link
Member

I think conversions of 16bit->8bit tend to be done by clipping everything above 255. It might work better to use the ImageMath module to map the 16bit values to 0-255, and then convert to L mode.

(a linear map would be easy, but other mappings might perserve more information)

@dbrunton
Copy link
Author

Huh, I've never encountered that behavior before. The four other toolkits we use (IrfanView, libtiff, Aware, and GraphicsMagic) all manage this conversion in a way that results in a more-or-less recognizable facsimile of the original.

We wound up, as a temporary hack, simply shelling out to tiff2rgba prior to saving as a jpeg, (e.g. check_call(["tiff2rgba", file, file])).

@aclark4life
Copy link
Member

Anything more to say on this issue? Is this a bug?

@aclark4life aclark4life added the Bug Any unexpected behavior, until confirmed feature. label Mar 26, 2015
@hugovk
Copy link
Member

hugovk commented Feb 17, 2019

Closing this as there's been no updates in 4 years.

@hugovk hugovk closed this as completed Feb 17, 2019
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

4 participants