-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
greyscale pngs appear inverted + transparent #15600
Comments
This was introduced in flutter/engine@0a7155d The image renders as expected if the engine passes an @brianosman should we be using a different color space configuration? |
I wouldn't expect any changes to color space handling of grayscale images. There have been changes to externally created grayscale images (that are wrapped in SkImages). I wouldn't expect that to affect this use-case either, although the incorrect image appears to be rendering as transparent, which could suggest a mis-match (of GL_ALPHA vs. GL_R8), which is the kind of thing that was modified. And because cross-context images do involve wrapping GL textures (even though they start out as SkImages), it's possible that's to blame. The sRGB thing probably works around it by forcing us to create the GL texture as RGBA8888 (because we don't have support for single channel sRGB encoded formats). I'll confer with other Skia folks... |
/cc @chinmaygarde |
@ltc Can you speak to the timeframe on which you care about this? Does using RGB images in the meantime work for you as a workaround? (Trying to determine how to prioritise this.) |
Yes - I'm currently working around this by converting to RGB before they arrive in flutter. It's not a showstopper at the moment, but the trade-off is these RGB images are being streamed, so it does triple the size. If this can be addressed in the next few months, that would be great. :) |
I've landed https://skia.googlesource.com/skia/+/052ef695708eddeaa81c3fcf5747824c1f0ad073 in Skia, which should fix this issue. It still needs to be rolled into the Flutter engine repo, but that should happen before too long. |
Great - thanks! :) |
@ltc Can you check with the master channel ( |
Checked - looks like it's fixed now. Thanks for fixing this! |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
When I try decoding greyscale pngs (1-channel, 8 bytes), they render as inverted transparent PNGs.
This may be an embedder client specific problem. This problem does not occur in the Android emulator (haven't tested this on other devices).
e.g.
Same problem occurs using Image.memory(imageBytes)
When I save the greyscale imageBytes to disk using file.writeAsBytes(imageBytes), I can see the expected image. Also using color pngs (3-channel, RGB) work fine.
Steps to Reproduce
Here is a reduced test case:
Here is the original image (the _base64 string in the above snippet):
Here is the expected output (screenshot from Android emulator):
Here is what I get instead:
The text was updated successfully, but these errors were encountered: