Skip to content

JPEG image being identified as MPO #1138

@xtagon

Description

@xtagon

Hi,

We're using Pilbox which depends on Pillow and performs image resizing as a service. A few of our images in production are failing because Pillow is returning the image format as MPO and not JPEG, so Pilbox throws an error because MPO is not a supported format.

The image identifies as a JPEG in ImageMagick, PhotoShop, etc. and opens fine in those programs as a JPEG. However, if we open the failing image in PhotoShop and save a new copy as a new JPEG file, the new image no longer reproduces the issue. Obviously there's something funky going on with the image file, but we can't identify what.

Here is a minimal test case showing the issue:

Image (should be JPEG, identifies as MPO): https://drive.google.com/file/d/0Bx-VFyfqu1DlaFlKVVk1ZDh6S2lPbGFwNUFlN3liQW1PRER3/view?usp=sharing

import sys
import PIL.Image

img = PIL.Image.open(sys.argv[1])
print(img.format)

Save the image to example.jpg and the python script to jpeg_mpo_test.py, and run:

python jpeg_mpo_test.py example.jpg

It prints "MPO" and not "JPEG".

We'd really appreciate any help in figuring this out as we are depending on these libraries on some live apps. Let me know what other information you need. Thanks in advance!

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