Skip to content
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

PSD: Can't read RLE - Index out of range #656

Open
ServOKio opened this issue Jun 15, 2024 · 3 comments
Open

PSD: Can't read RLE - Index out of range #656

ServOKio opened this issue Jun 15, 2024 · 3 comments

Comments

@ServOKio
Copy link

Image img = decodePsd(fileBytes);
flutter: Exception RangeError (index): Index out of range: index should be less than 1859584: 1859584
flutter: K:\pictures\sd\outputs\txt2img-images\2024-06-15\00033-3613106575.psd
flutter: StackTrace #0      _typedDataIndexCheck (dart:typed_data-patch/typed_data_patch.dart:5215:5)
#1      Uint8List.[]= (dart:typed_data-patch/typed_data_patch.dart:2263:13)
#2      PsdChannel._decodeRLE (package:image/src/formats/psd/psd_channel.dart:110:14)
#3      PsdChannel._readPlaneRleCompressed (package:image/src/formats/psd/psd_channel.dart:98:7)
#4      PsdChannel.readPlane (package:image/src/formats/psd/psd_channel.dart:49:9)
#5      PsdLayer.readImageData (package:image/src/formats/psd/psd_layer.dart:396:19)
#6      PsdImage._readLayerAndMaskData (package:image/src/formats/psd/psd_image.dart:465:17)
#7      PsdImage.decode (package:image/src/formats/psd/psd_image.dart:90:5)
#8      PsdImage.decodeImage (package:image/src/formats/psd/psd_image.dart:104:10)

2022-10-05_23-03 psd.zip

@brendan-duncan
Copy link
Owner

Fix is in git. I'll have to plan a release at some point in the near future, but might not be for a couple weeks due to a vacation.

@ServOKio
Copy link
Author

ServOKio commented Jun 16, 2024

It looks like I've run into two more new problems

  1. Exception RangeError (index): Index out of range: index should be less than...
    index should be less than 28926027: 28926027
    index should be less than 11570024: 11570024

  2. Exception ImageException: Unsupported compression: ***
    33024, 2569, 5374, 4125, 3856... a huge number of "methods"

The files come out too big, so I had to use google drive

@brendan-duncan
Copy link
Owner

I took out the code that tries to read the actual layers from the PSD, and it will just read the merged image now. PSD is too weird of a proprietary format to handle all those cases, but at least it always provides the merged image. The changes are in git, those images can be read now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants