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

Clarify saving LZW-compressed TIFFs in the documentation #5335

Closed
pkkm opened this issue Mar 16, 2021 · 4 comments · Fixed by #5336
Closed

Clarify saving LZW-compressed TIFFs in the documentation #5335

pkkm opened this issue Mar 16, 2021 · 4 comments · Fixed by #5336
Labels

Comments

@pkkm
Copy link

pkkm commented Mar 16, 2021

The documentation about saving TIFF images says that

Valid compression methods are: None, "tiff_ccitt", "group3", "group4", "tiff_jpeg", "tiff_adobe_deflate", "tiff_thunderscan", "tiff_deflate", "tiff_sgilog", "tiff_sgilog24", "tiff_raw_16"

However, I can create LZW-compressed TIFFs by passing a "tiff_lzw" value:

image.save("image.tif", compression="tiff_lzw")

Since LZW is a commonly used compression method, I think it would be good to clarify what's going on here:

  • Does it accidentally happen to work but with problems I'm not seeing?
  • Is the support dependent on the user's software configuration?
  • Is the value "tiff_lzw" officially supported and the fact that it isn't in the documentation is an oversight?
@radarhere
Copy link
Member

My answer is that it is a documentation oversight, so I've created #5336.

@pkkm
Copy link
Author

pkkm commented Mar 17, 2021

Thanks!

@kmilos
Copy link
Contributor

kmilos commented Mar 18, 2021

Also, I suggest taking out tiff_deflate from this doc list while you're at it, as it should not be used for writing, see this TIFF tech note:

A proprietary ZIP/Flate compression code (0x80b2) has been used by some software vendors. This code should be considered obsolete. The compression used by the obsolete code is identical to that defined above. We recommend that TIFF implementations recognize and read the obsolete code, but only write the official compression code (8).

I'd even go a step further and reassign the writing key as well:

COMPRESSION_INFO_REV = {v: k for k, v in COMPRESSION_INFO.items()}
# See deprecation note in https://www.adobe.io/content/dam/udp/en/open/standards/tiff/TIFFphotoshop.pdf
COMPRESSION_INFO_REV["tiff_deflate"] = 8

@radarhere
Copy link
Member

I've removed tiff_deflate in #5336, and created #5343 to change it to tiff_adobe_deflate when writing.

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.

3 participants