-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
What did you do?
Attempted to open the supplied psd image with PIL.open() in python.
I didn't actually create this image myself, nor can I figure out what exactly is wrong with it, but I've managed to reduce the cause of the issue down to 2 shape layers, one with a layer mask. Removing either layer fixes the error. Additionally, inserting a new empty layer between the two layers also fixes the error. So it's not critical and I can work around it, but I have a feeling it's a bug in the psd opening logic if it's somehow fixed by adding blank layers.
What did you expect to happen?
No PIL.UnidentifiedImageError when opening the PSD.
What actually happened?
Received a PIL.UnidentifiedImageError when opening the PSD with PIL.open()
What are your OS, Python and Pillow versions?
- OS: MacOS Sonoma 14.4.1
- Python: 3.9.6 (via shim/pyenv)
- Pillow: 10.3.0 (via pip)
--------------------------------------------------------------------
Pillow 10.3.0
Python 3.9.6 (default, Apr 6 2024, 22:52:34)
[Clang 15.0.0 (clang-1500.3.9.4)]
--------------------------------------------------------------------
Python executable is /Users/<username>/.pyenv/versions/3.9.6/bin/python3
System Python files loaded from /Users/<username>/.pyenv/versions/3.9.6
--------------------------------------------------------------------
Python Pillow modules loaded from /Users/<username>/.pyenv/versions/3.9.6/lib/python3.9/site-packages/PIL
Binary Pillow modules loaded from /Users/<username>/.pyenv/versions/3.9.6/lib/python3.9/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.3.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.3.2
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.2
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1
--- LIBTIFF support ok, loaded 4.6.0
*** RAQM (Bidirectional Text) support not installed
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------
Image is attached as zip because github doesn't allow psd attachments.
ExamplePSD.psd.zip (29kb)
Code to reproduce (simple open PSD script):
import sys
import PIL
from PIL import Image
def open_psd(psd_file_path):
# Open the PSD file
psd_image = Image.open(psd_file_path)
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python3 piltest.py <input_psd_path>")
else:
psd_file_path = sys.argv[1]
open_psd(psd_file_path)