Unexpected change in Image dimensions when loading from Stream in .NET MAUI on Android #31522
Unanswered
VishalOmprasad
asked this question in
General
Replies: 1 comment
-
CoPilot AI found this bug, but it is not related. The second one, looks more related, as it is Android specific too. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In a .NET MAUI project, I observed a change in image dimensions when loading an image using a stream:
image.Source = ImageSource.FromStream(_ => FileSystem.OpenAppPackageFileAsync($"images/{_filename}"));
This behavior is specifically noticeable on the Android platform. When measuring the image using Image.
ComputeDesiredSize()
, the returned size is significantly smaller than expected.However, when loading the same image using:
image.Source = ImageSource.FromFile(_filename);
The computed size matches the image’s actual dimensions.
Link to public reproduction project repository:
https://github.com/VishalOmprasad/MAUI-Issues
Questions:
ImageSource.FromStream
?Any insights, workarounds, or roadmap updates would be greatly appreciated. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions