Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

Libtiff metadata writing fixes

Open wiredfool opened this issue 8 years ago • 2 comments

Fixes #1765, #1147, #1597 (among others, likely)

Libtiff's metadata support is tricky and dangerous. This patch is 1/3 of the work to clean up our support for it.

  1. Understand and support writing basic metadata through libtiff. This includes casting numbers to the correct format and passing in arrays correctly for known items. (e.g., this fixes #1765, writing ints to dpi, and writing the colormap for P mode images)

  2. Consider supporting custom metadata tags safely. This is going to require reflection from libtiff to ensure that we're setting items correctly.

  3. Coordinate this work with the python metadata implementation in two places: When reading images where the type conflicts with the spec, and when writing (in python) metadata of incorrect types.

While this is not finished, I believe that this is a material improvement in the support for tiff metadata, and can be merged (after I'm happy and rebased out some things) for 3.5.

wiredfool avatar Dec 13 '16 12:12 wiredfool

Last few commits are the start of 2 and 3, but there's an issue with the sampleformat due to the differences between how we've had it defined and in tiff files, and how it's in the api. Additionally, I think the failures on appveyor are due to a libtiff5 vs libtiff4 difference.

Upshot is, I think I've got to handle most of this to do it right, and doing just 1 isn't going to cut it.

wiredfool avatar Dec 14 '16 16:12 wiredfool

Note that PR #3338 added a fix for #1765, so this PR will have to consider that change, or maybe just revert it in favour of this work.

radarhere avatar Sep 08 '18 07:09 radarhere