Skip to content

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Aug 11, 2022

Resolves #6492

The issue provides an image where tag 271 has type UNDEFINED. https://www.awaresystems.be/imaging/tiff/tifftags/make.html states tag 271 should have type ASCII. The tag is loaded as bytes then, not a string as expected, and when Pillow tries to encode the string, it fails.

This PR simply changes TiffImagePlugin to not encode if the variable is already bytes.

@hugovk hugovk merged commit 6697de1 into python-pillow:main Aug 31, 2022
@radarhere radarhere deleted the bytes_ascii branch August 31, 2022 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getexif().tobytes() throws 'bytes' object has no attribute 'encode'

2 participants