/// <summary> /// Handles the Click event of OkButton object. /// </summary> private void okButton_Click(object sender, EventArgs e) { // update encoder string selectedEncoder = encoderNameComboBox.SelectedItem.ToString(); switch (selectedEncoder) { case "PNG": PngEncoder pngEncoder = new PngEncoder(); // set encoder settings PngEncoderSettings pngSettings = GetPngEncoderSettings(pngSettingsComboBox.SelectedItem.ToString()); pngEncoder.Settings.FilterMethod = pngSettings.FilterMethod; pngEncoder.Settings.CompressionLevel = pngSettings.CompressionLevel; EncoderSettings.EmbeddedImageEncoder = pngEncoder; break; case "JPEG": // set encoder settings JpegEncoderSettings jpegSettings = new JpegEncoderSettings(); jpegSettings.Quality = (int)jpegQualityNumericUpDown.Value; jpegSettings.SaveAsGrayscale = jpegGrayscaleCheckBox.Checked; JpegEncoder jpegEncoder = new JpegEncoder(jpegSettings); EncoderSettings.EmbeddedImageEncoder = jpegEncoder; break; } }
public PngEncoder(PngEncoderSettings settings = null) { Settings = settings; }