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
Added tags when saving YCbCr TIFF #5597
Conversation
src/PIL/TiffImagePlugin.py
Outdated
if im.mode == "YCbCr" and not libtiff: | ||
for tag, value in { | ||
YCBCRSUBSAMPLING: (1, 1), | ||
REFERENCEBLACKWHITE: [15, 235, 128, 240, 128, 240], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should probably be by default the full range [0, 255, 128, 255, 128, 255], as that is what JPEG uses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got the numbers the "CCIR Recommendation 601.1 headroom/footroom" from http://www.verypdf.com/document/tiff6/txtidx0009.htm
You think that the "no headroom/footroom" option is better though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, 601 is for video really, while JPEG uses full range. See also #4668
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there is of course the (valid?) assumption that we're almost always dealing w/ full range image data that's not new here: either reading full range YCbCr from JPEG using draft() or doing the default full range RGB->YCbCr conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've updated the commit
0e03296
to
8d1e269
Compare
Resolves #5589
Ensures that tags 530 and 532 are present when saving a YCbCr TIFF.