`quality` parameter is ignored in `Bitmap.Save` with `.jpg`
See original GitHub issueDescribe the bug The parameter does not appear to have any effect and no warning is reported.
To Reproduce Steps to reproduce the behavior:
- Create a new
Bitmap
(I usedWriteableBitmap
) of ~1920x1080 - Fill it with non-trivial data
- Call
bitmap.Save("test.jpg", quality: 10)
(I also tried 1)
Expected behavior You get a low quality version of the bitmap weighting under 100KB
Actual behavior You get a high quality file over 1MB in size. It appears the resulting file is actually a PNG instead of JPEG.
Screenshots N/A
Desktop (please complete the following information):
- OS: Windows
- Version 11.0.2
Issue Analytics
- State:
- Created a month ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
"Parameter is not valid." when using saving bitmap
Im trying to save a bitmap jpg format with a specified encoding quality. However im getting an exception ("Parameter is not valid.
Read more >Image.save - the parameter is invalid.
When I try to save the image into a new stream, the code is throwing "Parameter is not valid" exception. Facts: - The...
Read more >How to Save PNG Images in C#
The "Quality" parameter above is actually ignored. Save as JPG. If you want to save the image as a JPG and specify the...
Read more >problems with changing of image compression quality
No. The Quality parameter, if you supply it, will be ignored because PNG doesn't have a Quality setting. BB.
Read more >How to: Set JPEG Compression Level
Each JPEG image is saved with a different quality level, by modifying the long value passed to the EncoderParameter constructor. A quality level ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To be clear, check for file extension is not present here, it is always saved as PNG https://github.com/AvaloniaUI/Avalonia/blob/1896e8ad68dc0fdb6c1055d36a97b926e0a32f17/src/Skia/Avalonia.Skia/Helpers/ImageSavingHelper.cs#L57C51-L57C51
I started working on support for image formats at least for saving. PR should be out in an hour or so.