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

Error: Index out of range #77

Closed
SpirikleOfficial opened this issue Jul 19, 2023 · 2 comments
Closed

Error: Index out of range #77

SpirikleOfficial opened this issue Jul 19, 2023 · 2 comments

Comments

@SpirikleOfficial
Copy link

By using the example dart code provided with the package I tried to upload an image of size 3.26 MB when I encountered this error:

Unhandled Exception: RangeError (index): Index out of range: index should be less than 3276356: 341989477
E/flutter (31500): #0 Uint8List.[] (dart:typed_data-patch/typed_data_patch.dart:3066:7)
E/flutter (31500): #1 InputBuffer.readUint16 (package:image/src/util/input_buffer.dart:154:22)
E/flutter (31500): #2 ExifData._readEntry (package:image/src/exif/exif_data.dart:615:23)
E/flutter (31500): #3 ExifData.read. (package:image/src/exif/exif_data.dart:598:15)
E/flutter (31500): #4 new _GrowableList.generate (dart:core-patch/growable_array.dart:136:28)
E/flutter (31500): #5 ExifData.read (package:image/src/exif/exif_data.dart:597:23)
E/flutter (31500): #6 JpegData._readExifData (package:image/src/formats/jpeg/jpeg_data.dart:282:10
E/flutter (31500): #7 JpegData._readAppData (package:image/src/formats/jpeg/jpeg_data.dart:308:7)
E/flutter (31500): #8 JpegData._read (package:image/src/formats/jpeg/jpeg_data.dart:168:11)
E/flutter (31500): #9 JpegData.read (package:image/src/formats/jpeg/jpeg_data.dart:117:5)
E/flutter (31500): #10 JpegDecoder.decodeImage (package:image/src/formats/jpeg_decoder.dart:46:10)
E/flutter (31500): #11 decodeImage (package:image/src/formats/formats.dart:93:18)
E/flutter (31500): #12 _MyAppState.getImage (package:temp/main.dart:36:28)
E/flutter (31500):

I am running this on device POCO F4 with android version 12.

Dart version is 2.10.5 and flutter version is 3.3.9.

flutter doctor -v.txt

However, when I tried with another image then the package worked, even though the image size was 3.36 MB. Can't pinpoint the issue please help

@SpirikleOfficial
Copy link
Author

Found out the problem. Was using the image library 3.3.0, which caused the issue. However, next version of image is 4.0.0 and the photofilters package has compatibility issues. So had to downgrade to 3.2.2 to keep using the package. Hope the author can help in this.
Have a good day!

@batoul-alani
Copy link

This error occurs when the selected image has an odd number of pixels. The apply filter method contains a for loop that iterates over the pixels list with increments of 4.
I have resolved the issue and made the necessary changes on this pull request. Kindly review the changes using the link provided.
#80

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