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

YCbCr mode TIFF saving not functional #5589

Closed
kmilos opened this issue Jul 7, 2021 · 5 comments · Fixed by #5597
Closed

YCbCr mode TIFF saving not functional #5589

kmilos opened this issue Jul 7, 2021 · 5 comments · Fixed by #5597
Labels

Comments

@kmilos
Copy link
Contributor

kmilos commented Jul 7, 2021

This is w/ Pillow 8.3.1.

  1. Uncompressed saving (i.e. not using libtiff_encode) doesn't set tag 530 to (1,1), and mandatory tag 532:
import PIL.Image
image = PIL.Image.new('YCbCr', (1760, 1046))
image.save('test_ycbcr_nocomp.tif')

Resulting file is invalid - compare to tags in tiff_strip_ycbcr_jpeg_1x1_sampling.tif

  1. When using compression and/or libtiff_encode, even if added somehow, tag 530 doesn't get stored correctly and encoding fails:
import PIL.Image
image = PIL.Image.new('YCbCr', (1760, 1046))
image.save('test_ycbcr_libtiff.tif', compression='jpeg')

See also #5588 (comment)

@radarhere
Copy link
Member

I've created #5597 to fix 1.

@kmilos
Copy link
Contributor Author

kmilos commented Jul 9, 2021

Thanks, that's what I had in mind as well for 1.

@kmilos
Copy link
Contributor Author

kmilos commented Jul 9, 2021

As far as item 2 goes, would removing 530 and 532 from "core tags" in both PIL/TiffTags.py and encode.c perhaps let them be encoded properly from the ifd dictionary?

@radarhere
Copy link
Member

I've updated the PR so that it should now cover 2 as well.

@radarhere
Copy link
Member

In combination with #5588, that resolves this.

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 a pull request may close this issue.

2 participants