How to save a Jpg file with quality option
The result
First let's see the results of images in different quality levels. The highest quality is 100, the lowest quality is 0.
Original image:
Quality 75 image:
Quality 50 image:
Quality 25 image:
Quality 0 image:
If you compare the images above carefully, you will find noise is lesser when the quality is higher. We can also find the image size is larger when the quality is higher.
In the example above:
original image's size is: 1810kb
quality 75 image's size is: 329kb
quality 50 image's size is: 186kb
quality 25 image's size is: 127kb
quality 0 image's size is: 82kb
How to use it
The key is feature {WEL_GDIP_IMAGE}.save_image_to_file_with_encoder_and_parameters. This feature will use {WEL_GDIP_IMAGE_ENCODER_PARAMETERS} as last parameter. When saving a image we can not only set quality parameter, but also compression, color_depth, scan_method, version, render_method, transformation, luminance_table, chrominance_table and save_flag parameters. For the parameter type enumeration, please see {WEL_GDIP_IMAGE_ENCODER}.
PS:
Quality parameter has effects on Jpeg format images. For Png format images, the quality parameter will not work.
Saving image with parameters feature is added in revision#72923.