Skip to content

Added tags when saving YCbCr TIFF - #5597

Merged
hugovk merged 1 commit into
python-pillow:masterfrom
radarhere:ycbcr_tiff
Jul 28, 2021
Merged

hugovk merged 1 commit into
python-pillow:masterfrom
radarhere:ycbcr_tiff

Conversation

@radarhere

@radarhere radarhere commented Jul 9, 2021 •

Copy link
Copy Markdown
Member

Resolves #5589

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

Comment thread 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],

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@kmilos kmilos Jul 9, 2021 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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