protected override void OnSave(Document input, Stream output, SaveConfigToken token, Surface scratchSurface, ProgressEventHandler callback) { JpegSaveConfigToken jsct = (JpegSaveConfigToken)token; ImageCodecInfo icf = GdiPlusFileType.GetImageCodecInfo(ImageFormat.Jpeg); EncoderParameters parms = new EncoderParameters(1); EncoderParameter parm = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, jsct.Quality); // force '95% quality' parms.Param[0] = parm; scratchSurface.Clear(ColorBgra.White); using (RenderArgs ra = new RenderArgs(scratchSurface)) { input.Render(ra, true); } using (Bitmap bitmap = scratchSurface.CreateAliasedBitmap()) { GdiPlusFileType.LoadProperties(bitmap, input); bitmap.Save(output, icf, parms); } }
protected JpegSaveConfigToken(JpegSaveConfigToken cloneMe) { this.quality = cloneMe.quality; }