-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
compositeImage not working iOS in flutter 3.19.5 #639
Comments
I'll take a look |
Hello @brendan-duncan, were you able to reproduce the error? If you need more information let me know. |
Sorry, I got busy by work and haven't had a chance yet. I don't know much about Flutter. What is impeller? |
Impeller is the new rendering engine that Flutter is using, it is currently only being used on iOS. Here is a link with an explanation of Flutter itself |
If I were to guess I'd say the black is getting alpha blended with Impeller. It doesn't make all that much sense because you're converting it to a 1 channel image before sending the bytes, but that's what it looks like it's doing. I don't know what you're doing with the bytes from _toColumnFormat. If I were to clean this up, and I don't know if it will help the impeller issue or not, I would write it as: List<List<int>> _toColumnFormat(Image image, int lineHeight) {
// No need to make a copy, you're not modifying image
// Determine new width: closest integer that is divisible by lineHeight
final int widthPx = (image.width + lineHeight) - (image.width % lineHeight);
final int heightPx = image.height;
// Create a black bottom layer
final biggerImage = Image(width: widthPx, height: hieghtPx); // defaults to 3 channel, no alpha
// The default pixel values will be 0 for a new image
// Insert source image into bigger one
compositeImage(biggerImage, image, dstX: 0, dstY: 0);
grayscale(biggerImage); // Might as well filter the entire image instead of per crop
final imgBinary = biggerImage.convert(numChannels: 1); // Might as well convert the entire image, less work for crop
int left = 0;
final List<List<int>> blobs = [];
while (left < widthPx) {
final Image slice = copyCrop(biggerImage, x: left, y: 0, width: lineHeight, height: heightPx);
final bytes = slice.getBytes();
blobs.add(bytes);
left += lineHeight;
}
return blobs;
} |
I recently updated the Flutter version to 3.19.5 and when running with impeller activated (which is the default) it behaves differently than expected, see the images.
Impeller off:
Impeller on:
My code:
The text was updated successfully, but these errors were encountered: