Skip to content

Large JPEG with DAC compression gives OSError: broken data stream when reading image file #9162

@dseomn

Description

@dseomn

What did you do?

I tried to load an image.

What did you expect to happen?

The image to load. gThumb and ImageMagick can load it, but Pillow and Loupe can't. Loupe says Parsing of the following header `DAC` is not supported, which makes me think that it might be an unsupported format issue rather than a corrupt file?

What actually happened?

In [45]: PIL.Image.open("/home/dseomn/Code/david.mandelberg.org/private/posts/2013-08-17-europe-trip/P1080392-raw-P1080403-raw.jpg").load()
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
Cell In[45], line 1
----> 1 PIL.Image.open("/home/dseomn/Code/david.mandelberg.org/private/posts/2013-08-17-europe-trip/P1080392-raw-P1080403-raw.jpg").load()

File /usr/lib/python3/dist-packages/PIL/ImageFile.py:319, in ImageFile.load(self)
    315 self.fp = None
    317 if not self.map and not LOAD_TRUNCATED_IMAGES and err_code < 0:
    318     # still raised if decoder fails to return anything
--> 319     raise _get_oserror(err_code, encoder=False)
    321 return Image.Image.load(self)

OSError: broken data stream when reading image file

What are your OS, Python and Pillow versions?

  • OS: Debian testing/unstable
  • Python: 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0]
  • Pillow: 11.1.0-5+b1
--------------------------------------------------------------------
Pillow 11.1.0
Python 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0]
--------------------------------------------------------------------
Python executable is /usr/bin/python3
System Python files loaded from /usr
--------------------------------------------------------------------
Python Pillow modules loaded from /usr/lib/python3/dist-packages/PIL
Binary Pillow modules loaded from /usr/lib/python3/dist-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 11.1.0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.13.3
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.5.0
--- JPEG support ok, compiled for libjpeg-turbo 2.1.5
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.3
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1
--- LIBTIFF support ok, loaded 4.7.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.2
--- LIBIMAGEQUANT (Quantization method) support ok, loaded 2.18.0
--- XCB (X protocol) support ok
--------------------------------------------------------------------
PIL.Image.open("/home/dseomn/Code/david.mandelberg.org/private/posts/2013-08-17-europe-trip/P1080392-raw-P1080403-raw.jpg").load()

The image is 48MB, which seems to be too large to upload to GitHub, but I was able to upload it to another bug report about the same image.

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