-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Description
What did you do?
I'm trying to read IPTC metadata from a TIFF image.
A simple example would be:
from PIL import Image
with Image.open(file_path) as im:
print(getiptcinfo(im))What did you expect to happen?
The IPTC metadata output
What actually happened?
A TypeError saying a bytes-like object is required, not 'int'
What are your OS, Python and Pillow versions?
- OS: Windows 10
- Python: 3.12
- Pillow: 11.0.0
An image that reproduces the error can be found here: test_iptc_metadata.zip. The IPTC metadata in this image was created using both GIMP and Photoshop. However, neither application’s metadata is handled correctly in Pillow version 11.0.0.
This issue does not occur in Pillow version 10.4.0, where the metadata is processed as expected. The problem was likely introduced by a change made in the following line of code, which now returns an int type instead of a bytes type, leading to the error mentioned above.
Previously, in versions before 11.0.0, the line was:
data = im.tag.tagdata[TiffImagePlugin.IPTC_NAA_CHUNK]Metadata
Metadata
Assignees
Labels
No labels