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

Fixed writing bytes as ASCII tag #6493

Merged
merged 1 commit into from
Aug 31, 2022
Merged

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