Skip to content

Pillow 11.1.0 not reading JPEG comment #8787

@ssokolow

Description

@ssokolow

What did you do?

Loaded the attached image using the provided code.

What did you expect to happen?

As documented in the Image file formats page, there should be a comment field in the info dict containing the same data as this exiftool output:

User Comment                    : {"prompt": "a photograph of an astronaut riding a horse", "negative_prompt": "", "seed": 0, "use_stable_diffusion_model": "sd-v1-5", "clip_skip": false, "use_controlnet_model": null, "control_alpha": null, "use_vae_model": "", "sampler_name": "euler_a", "width": 512, "height": 768, "num_inference_steps": 25, "guidance_scale": 7.5, "use_lora_model": null, "use_embeddings_model": null, "tiling": null, "use_face_correction": null, "use_upscale": null}

What actually happened?

The comment field is missing.

What are your OS, Python and Pillow versions?

  • OS: Kubuntu Linux 22.04 LTS
  • Python: 3.10.12
  • Pillow: 11.1.0
--------------------------------------------------------------------
Pillow 11.1.0
Python 3.10.12 (main, Feb  4 2025, 14:57:36) [GCC 11.4.0]
--------------------------------------------------------------------
Python executable is [REDACTED]/.venv/bin/python3
Environment Python files loaded from [REDACTED]/.venv
System Python files loaded from /usr
--------------------------------------------------------------------
Python Pillow modules loaded from [REDACTED]/.venv/lib/python3.10/site-packages/PIL
Binary Pillow modules loaded from [REDACTED]/.venv/lib/python3.10/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 11.1.0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.5.0
--- JPEG support ok, compiled for libjpeg-turbo 3.1.0
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.3
--- ZLIB (PNG/ZIP) support ok, loaded 1.2.11, compiled for zlib-ng 2.2.2
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.8, harfbuzz 10.1.0
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------
from PIL import Image
im = Image.open('a_photograph_of_an_astronaut_riding_a_horse_4MZPQQN0.jpeg')
print(im.info)

JPEG generated using Easy Diffusion with embedded metadata

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions