Skip to content

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

@gverm

Description

@gverm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions