Pillow
Pillow copied to clipboard
Fixed writing bytes as ASCII tag
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.