Skip to content

MPO format loading error when EXIF data is present #5164

@JackDesBwa

Description

@JackDesBwa

Someone sent me a MPO file that I was not able to open with Pillow
It looks like the second image of the file has EXIF data that might conflict with the loading process.
In particular, the reported size does not correspond to the image, but I was not able to figure out if it is the root cause of the bug.

I created a similar image that you can use for your tests and publish if you need. I copied the EXIF of the original file with some subtractions such as the embedded thumbnail. It exhibits the same behavior and is correctly loaded by some other players, such as geeqie or sView.

In this ZIP (pillow_mpo_exif_error.zip), you will find the sample image and a script that show the error with this output: [visible with 8.0.1]

Image 0 size: (64, 64)
Image 0 loaded
Image 1 size: (5472, 3648)
Image 1 error: image file is truncated (0 bytes not processed)

As you can see, the second image is reported to be 5472×3648 but is actually 64×64 like the first one.

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