New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Photoshop PSD errors with Truncated File Read #7482
Comments
Could you attach a copy of a problem file? |
Attached |
Thanks. Taking a look, I see that as Pillow is processing the layers, it detects that one of them has more than 4 channels. This would be the layer that is RGBA and has a layer mask. Pillow attempts to move on to the next layer, but forgets to skip past the rest of the layer data. I've created PR #7483 to resolve this, by correctly skipping past the rest of the layer data. With that change, the following simple code can load and resave your file as the following PNG. from PIL import Image
psd = Image.open("file.psd")
psd.save("out.png") |
Wow, thank you. Incredible response time and very informative. Appreciate your hard work and help! 🙏 |
What did you do?
Tried to open a Photoshop
psd
file that loads fine in Photoshop.This issue came up as I'm processing multiple Photoshop
psd
files at a time on a project. Some files work fine, others do not. All of the files open fine in Photoshop 2023.Ultimately for this purpose I'm just looking to get the dimensions of the file and confirm the format. But in the future would like to actually be doing more processing on these files.
What did you expect to happen?
I expected the file to be opened.
What actually happened?
The code errors with
OSError: Truncated File Read
despite using theImageFile.LOAD_TRUNCATED_IMAGES = True
option.This same result happens whether opening from a file path or loading bytes and opening from there. I tried several methods recommended in previous Github issue submissions.
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: