Description
If to set QualityLevel of JpegBitmapEncoder to 75, the quality level of a generated image will be 90, not 75.
This happens because SetupFrame method checks if the value of the level is a default one (that is 75) and doesn't set ImageQuality property of the native encoder.
But, according to https://learn.microsoft.com/en-us/windows/win32/wic/jpeg-format-overview the default value of the quality in the native encoder is not 0.75, but 0.9.
Reproduction Steps
Execute the following code:
using var imageStreamSource = new FileStream("input.png", FileMode.Open, FileAccess.Read, FileShare.Read);
var decoder = BitmapDecoder.Create(imageStreamSource, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
var frame = decoder.Frames[0];
var encoder = new JpegBitmapEncoder()
{
QualityLevel = 75,
};
encoder.Frames.Add(decoder.Frames[0]);
using var fileStream = new FileStream("output.jpg", FileMode.Create);
encoder.Save(fileStream);
Expected behavior
Saved JPEG image has Quality Level 75
Actual behavior
Saved JPEG image has Quality Level 90
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
No response
Other information
No response
Description
If to set QualityLevel of JpegBitmapEncoder to 75, the quality level of a generated image will be 90, not 75.
This happens because SetupFrame method checks if the value of the level is a default one (that is 75) and doesn't set ImageQuality property of the native encoder.
But, according to https://learn.microsoft.com/en-us/windows/win32/wic/jpeg-format-overview the default value of the quality in the native encoder is not 0.75, but 0.9.
Reproduction Steps
Execute the following code:
Expected behavior
Saved JPEG image has Quality Level 75
Actual behavior
Saved JPEG image has Quality Level 90
Regression?
No response
Known Workarounds
No response
Impact
No response
Configuration
No response
Other information
No response