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

Added tags when saving YCbCr TIFF #5597

Merged
merged 1 commit into from Jul 28, 2021
Merged

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Jul 9, 2021

Resolves #5589

Ensures that tags 530 and 532 are present when saving a YCbCr TIFF.

if im.mode == "YCbCr" and not libtiff:
for tag, value in {
YCBCRSUBSAMPLING: (1, 1),
REFERENCEBLACKWHITE: [15, 235, 128, 240, 128, 240],
Copy link
Contributor

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?

Copy link
Member Author

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?

Copy link
Contributor

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

Copy link
Contributor

@kmilos kmilos Jul 9, 2021

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.

Copy link
Member Author

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

@radarhere radarhere force-pushed the ycbcr_tiff branch 2 times, most recently from 0e03296 to 8d1e269 Compare July 9, 2021 14:34
@radarhere radarhere changed the title Added default tags when saving uncompressed YCbCr TIFF Added tags when saving YCbCr TIFF Jul 9, 2021
@hugovk hugovk merged commit 4e4d580 into python-pillow:master Jul 28, 2021
@radarhere radarhere deleted the ycbcr_tiff branch July 28, 2021 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

YCbCr mode TIFF saving not functional
3 participants