cgohlke / tifffile

Read and write TIFF files
https://pypi.org/project/tifffile
BSD 3-Clause "New" or "Revised" License
529 stars 155 forks source link

API for deleting tiff tags #246

Closed danlamanna closed 2 months ago

danlamanna commented 6 months ago

Hey, thanks for the package :)

I have some large cloud optimized geotiffs and I'm trying to remove specific tags from them. I was looking through the code and saw the __delitem__ implementation, but it appears to only delete them from the in-memory tag registry. Is there a way to delete tags from a file on disk? Or should I rewrite the file omitting the tags I want to remove, and if so, is there a recommended way of doing so?

Thanks!

cgohlke commented 6 months ago

There is currently no API for deleting tags, just changing tag types and values. It should be easy to add in principle, but would leave many class instances out of sync with the state of the file...

Tifffile cannot write COGs with pyramid levels.

The tiffset tool from the libtiff library apparently supports unsetting tags.

Or try tifftools.