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

RangeError (index): Index out of range: index should be less than ... #6

Open
Alii-isk opened this issue Mar 14, 2021 · 1 comment
Open

Comments

@Alii-isk
Copy link

Alii-isk commented Mar 14, 2021

I am having a problem when trying to feeding the images to DiffImage.compareFromMemory
I used this line to convert from Imagebytes to Image

import 'package:image/image.dart' as img


Uint8List imageBytes = await getImageBytes();
img.Image firstImage = img.Image.fromBytes(300, 300, imageBytes); 
...
@nitinramadoss
Copy link

When using Image.fromBytes(width, height, bytes) you must supply the right dimensions for the byte array, otherwise the data won't match the dimensions. I recommend using decodeImage(bytes) to create the image object.

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