public override IImageEncoder CreateEncoder() { if (QuantizationMethod != null || ColorTableMode != null) { return(new GifEncoder { ColorTableMode = (SharpGifColorTableMode?)ColorTableMode, Quantizer = ImageSharpUtility.CreateQuantizer(QuantizationMethod) }); } return(base.CreateEncoder()); }
public override IImageEncoder CreateEncoder() { if (BitDepth != null || ColorType != null || CompressionLevel != null || Gamma != null || Threshold != null || QuantizationMethod != null || InterlaceMode != null || ChunkFilter != null || TransparentColorMode != null || IgnoreMetadata) { var encoder = new PngEncoder { BitDepth = (SharpPngBitDepth?)BitDepth, ColorType = (SharpPngColorType?)ColorType, Gamma = Gamma, InterlaceMethod = (SharpPngInterlaceMode?)InterlaceMode, ChunkFilter = (SharpPngChunkFilter?)ChunkFilter, Quantizer = ImageSharpUtility.CreateQuantizer(QuantizationMethod), IgnoreMetadata = IgnoreMetadata }; if (TransparentColorMode != null) { encoder.TransparentColorMode = (SharpPngTransparentColorMode)TransparentColorMode.Value; } if (CompressionLevel != null) { encoder.CompressionLevel = (SharpPngCompressionLevel)CompressionLevel; } if (Threshold != null) { encoder.Threshold = Threshold.Value; } return(encoder); } return(base.CreateEncoder()); }