Type Default Value Read Only Static Description
Int32 50 No No The quality when performing a lossy compression, for example with JPEG or SWF.
Notes

You can provide a numeric value between 0 and 100. If you supply a negative value, it will be converted to zero. If you supply a value greater than 100, it will be converted to 100.

This property is ignored if the graphic exporter does not support it. It is typically used when exporting to JPEG.

Example

[C#]using (Bitmap bm = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/felix-tchverkin-7pkN83wDZwY-unsplash.jpg"))) {
  bm.Save(Server.MapPath("IG8_EncoderParameters_Quality1.jpg"), ImageFormat.Jpeg);
  EncoderParameters p2 = new EncoderParameters() { Quality = 100 };
  bm.Save(Server.MapPath("IG8_EncoderParameters_Quality2.jpg"), ImageFormat.Jpeg, p2);
  EncoderParameters p3 = new EncoderParameters() { Interlace = true };
  bm.Save(Server.MapPath("IG8_EncoderParameters_Quality3.gif"), ImageFormat.Gif, p3);
  ColorPaletteType palette = new ColorPaletteType(ColorPaletteFamily.Uniform, 32);
  EncoderParameters p4 = new EncoderParameters() { TransparentPoint = new PointF(10, 10), Palette = palette };
  bm.Save(Server.MapPath("IG8_EncoderParameters_Quality4.gif"), ImageFormat.Gif, p4);
}


This code produces four files as output. The first two files are jpeg images. The second is saved in high quality.

The second two files are gif images. The first is interlaced and the second is transparent (using the color at the point 10,10 as the transparent color).


felix-tchverkin-7pkN83wDZwY-unsplash.jpg


IG8_EncoderParameters_Quality1.jpg


IG8_EncoderParameters_Quality2.jpg


IG8_EncoderParameters_Quality3.gif


IG8_EncoderParameters_Quality4.gif