Contains all the possible JPEG writing settings.
Namespace:
Aurigma.GraphicsMill.Codecs
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
public sealed class JpegSettings : WriterSettings
The main JPEG encoder setting is a quality/file size ratio. It is specified with Quality property. This property accepts values in range [0, 100]
where 0 means the lowest quality (but smallest file size) and 100 means the highest quality (but largest file size).
Besides of this you can specify is JPEG should be progressive (using IsProgressive). It allows the browsers to display the JPEG file while it is being downloaded (displaying more and more details upon new file portions download). Unfortunately this feature is not supported with Internet Explorer browser.
Another compression setting can be changed via UseSubsampling property. Chroma subsampling is one of the compression methods used in JPEG. It is based on the specific of the human vision and allows to reduce size of the result file by storing color information at lower resolution than luminance information. In most cases this tradeoff will not be noticeable to the human. But sometimes such information loss may be significant (e.g. for some classes of image processing algorithms) and chroma subsampling should be turned off. Chroma subsampling is enabled by default.
You can also provide meta-information for encoding. Use AdobeResources, Exif and Iptc properties to specify corresponding metadata objects.
The following code saves JPEG file with the quality value set to 90, disabled chroma subsampling, and the enabled JPEG progressive technique.
using (var bitmap = new Bitmap(@"Images\in.jpg")) { var jpegSettings = new JpegSettings(); jpegSettings.Quality = 90; jpegSettings.UseSubsampling = false; jpegSettings.IsProgressive = true; bitmap.Save(@"Images\Output\out.jpg", jpegSettings); }