Skip to content

Conversation

@radarhere
Copy link
Member

Resolves #6799

The image from the issue has a GPSLongitudeRef tag that should be ASCII, but is instead SHORT.

The tag is loaded as an int then, not a string as expected, and when Pillow tries to save it as a string, it fails.

This PR simply changes TiffImagePlugin to convert the variable to a string.


out = str(tmp_path / "temp.tiff")
im.save(out, tiffinfo=info)
for (value, expected) in {b"test": "test", 1: "1"}.items():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these to @pytest.mark.parametrize?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, done

@hugovk hugovk merged commit 1ba19b1 into python-pillow:main Dec 29, 2022
@radarhere radarhere deleted the int_ascii branch December 29, 2022 21:48
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.

AttributeError: 'int' object has no attribute 'encode'

2 participants