예제 #1
0
            public void ShouldSharpenTheImage()
            {
                using (var image = new MagickImage(Files.NoisePNG))
                {
                    using (var original = image.Clone())
                    {
                        image.Sharpen(10, 20);
                        image.Clamp();

                        Assert.AreEqual(0.06675, image.Compare(original, ErrorMetric.RootMeanSquared), 0.00001);
                    }
                }
            }
예제 #2
0
            public void ShouldBeAbleToPerformPerspectiveDistortion()
            {
                using (IMagickImage image = new MagickImage(Files.MagickNETIconPNG))
                {
                    image.BackgroundColor    = MagickColors.Cornsilk;
                    image.VirtualPixelMethod = VirtualPixelMethod.Background;
                    image.Distort(DistortMethod.Perspective, new double[] { 0, 0, 0, 0, 0, 90, 0, 90, 90, 0, 90, 25, 90, 90, 90, 65 });
                    image.Clamp();

                    ColorAssert.AreEqual(new MagickColor("#0000"), image, 1, 64);
                    ColorAssert.AreEqual(MagickColors.Cornsilk, image, 104, 50);
                    ColorAssert.AreEqual(new MagickColor("#aa4de148f9cb"), image, 66, 62);
                }
            }
예제 #3
0
                public void ShouldReadImageFromCmkyColorName()
                {
                    var red = new MagickColor("cmyk(0%,100%,100%,0)");

                    using (var image = new MagickImage())
                    {
                        image.Read(red, 20, 30);
                        Assert.Equal(20, image.Width);
                        Assert.Equal(30, image.Height);
                        Assert.Equal(ColorSpace.CMYK, image.ColorSpace);
                        image.Clamp();
                        ColorAssert.Equal(red, image, 10, 10);
                    }
                }
예제 #4
0
            public void ShouldUseTheVibrance()
            {
                using (var image = new MagickImage(Files.Builtin.Rose))
                {
                    image.WhiteBalance(new Percentage(70));
#if Q8
                    ColorAssert.Equal(new MagickColor("#00a13b"), image, 45, 25);
#elif Q16
                    ColorAssert.Equal(new MagickColor("#0000a2043c3e"), image, 45, 25);
#else
                    image.Clamp();
                    ColorAssert.Equal(new MagickColor("#0000a2033c3d"), image, 45, 25);
#endif
                }
            }