Writing TIFF tags: improved BYTE, added UNDEFINED #4605
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #3677
This PR has two changes.
Firstly, Pillow currently treats BYTE tags of count N as if they might have N strings. I do not believe this should be the case. To look at count values for character-related tags, the BYTE tag GPSAltitudeRef has count 1 for 1 character, the ASCII tag GPSDateStamp has count 11 for 11 characters, and the UNDEFINED tag Flashpix Version has count 4 for 4 characters. So, I think BYTE tags of count N have N characters, and are only single strings.
Secondly, this PR changes the following current code, to no longer force BYTE tags into ASCII tags.
Pillow/src/encode.c
Lines 732 to 736 in d23df72
This second change was made because in trying to resolve the issue, I found that libtiff was throwing an error for the XMLPACKET tag. It seems reasonable that it would - it is a BYTE tag, and we are instead passing ASCII.
Together, these changes resolve the issue.