Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Exif tag 'IptcNaaInfo' (33723) causes crash when saving TIFF as JPEG ('TypeError: object of type 'int' has no len()') #6948

Closed
gverm opened this issue Feb 13, 2023 · 1 comment · Fixed by #6950

Comments

@gverm
Copy link

gverm commented Feb 13, 2023

What did you do?

Opened TIFF image, grabbed exif, tried to save TIFF as JPEG with exif.

What did you expect to happen?

JPEG to be saved successfully.

What actually happened?

Crash: TypeError: object of type 'int' has no len()

What are your OS, Python and Pillow versions?

  • OS: EndeavourOS
  • Python: 3.10 & 3.11
  • Pillow: 9.4.0 and current git
from PIL import Image, ExifTags, TiffImagePlugin, ImageOps
Image.MAX_IMAGE_PIXELS = None
src_img = Image.open("7ba1a16b64cb74a285d0b8f0e5ea652d-2002-078-839.tif")
exif = src_img.getexif()
dst_img = ImageOps.exif_transpose(src_img).convert("RGB")
dst_img.save("test.jpg", quality=95, exif=exif)

Removing the tag allows the jpeg to be saved successfully. This seems to be at least related to the same tag as issue #5852.
Image to reproduce

@radarhere
Copy link
Member

I've created PR #6950 for this.

hugovk added a commit that referenced this issue Feb 14, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants