Cross-Platform Support for Saving Images in JPG Format in .NET MAUI #31657
Unanswered
VishalOmprasad
asked this question in
General
Replies: 0 comments
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.
-
I am developing an image-saving feature in a .NET MAUI application and am seeking guidance on ensuring consistent, cross-platform behavior.
The goal is to allow users to save images in the following formats:
.png
).jpeg
).bmp
).jpeg
for JPEG-encoded images)While PNG, JPEG, and BMP are mostly supported across platforms, adding support for
.jpg
extension has revealed inconsistent behavior across platforms.Current Implementation Status:
Windows:
.png
,.jpeg
,.bmp
, and.jpg
by providing the format as a string..jpg
and.jpeg
files have identical sizes (e.g., both 300 KB). However, unclear whether this behavior is correct.Android:
Bitmap.CompressFormat.JPEG
, Android'sMediaStore
automatically assigns a.jpg
extension based on theimage/jpeg
MIME type, regardless of whether.jpeg
was specified in the filename..iOS/MacCatalyst:
UIImage.AsJPEG()
andUIImage.AsPNG()
work reliably for saving files with.jpeg
and.png
extensions..jpg
extension results in:.png
extension or not recognized)..jpeg
and.png
extensions seem to work reliably.Questions:
.jpg
extension on all platforms, especially iOS?UIImage
or the underlying OS, where it strictly prefers the.jpeg
extension?MediaStore
's default behavior to enforce a user-specified extension, or should we align with the platform's convention and always use.jpg
?.jpg
be treated as an alias for .jpeg within the application's logic, with platform-specific code to handle the final file extension, or is there a more unified approach?Any insights, workarounds, or roadmap updates would be greatly appreciated. Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions