public void Test_Quantize() { QuantizeSettings settings = new QuantizeSettings(); settings.Colors = 8; Assert.AreEqual(DitherMethod.Riemersma, settings.DitherMethod); settings.DitherMethod = null; Assert.AreEqual(null, settings.DitherMethod); settings.DitherMethod = DitherMethod.No; Assert.AreEqual(DitherMethod.No, settings.DitherMethod); using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG)) { image.Quantize(settings); } }
private void ExecuteQuantize(XmlElement element, MagickImage image) { QuantizeSettings settings_ = CreateQuantizeSettings(element["settings"]); image.Quantize(settings_); }
public void Test_Quantize() { QuantizeSettings settings = new QuantizeSettings(); settings.Colors = 8; Assert.AreEqual(DitherMethod.Riemersma, settings.DitherMethod); settings.DitherMethod = null; Assert.AreEqual(null, settings.DitherMethod); settings.DitherMethod = DitherMethod.No; Assert.AreEqual(DitherMethod.No, settings.DitherMethod); settings.MeasureErrors = true; Assert.AreEqual(true, settings.MeasureErrors); using (MagickImage image = new MagickImage(Files.FujiFilmFinePixS1ProJPG)) { MagickErrorInfo errorInfo = image.Quantize(settings); #if Q8 Assert.AreEqual(6.975, errorInfo.MeanErrorPerPixel, 0.001); #elif Q16 || Q16HDRI Assert.AreEqual(1803.2, errorInfo.MeanErrorPerPixel, 0.1); #else #error Not implemented! #endif Assert.AreEqual(0.352, errorInfo.NormalizedMaximumError, 0.002); Assert.AreEqual(0.001, errorInfo.NormalizedMeanError, 0.001); } }