Example #1
0
        public void MagickNet(string input, string output)
        {
            using (var im = new MagickImage(input))
            {
                im.Shave(100, 100);
                im.Resize(new Percentage(90.0));

                // All values in the kernel are divided by 8 (to match libvips scale behavior)
                var kernel = new ConvolveMatrix(3, -0.125, -0.125, -0.125, -0.125, 2, -0.125, -0.125, -0.125, -0.125);
                im.Convolve(kernel);

                im.Write(output);
            }
        }
Example #2
0
        public void MagickNet(string input, string output)
        {
            using var im   = new MagickImage(input);
            im.Interpolate = PixelInterpolateMethod.Bilinear;
            im.FilterType  = FilterType.Triangle;

            im.Shave(100, 100);
            im.Resize(new Percentage(90.0));

            var kernel = new ConvolveMatrix(3, -1, -1, -1, -1, 16, -1, -1, -1, -1);

            im.SetArtifact("convolve:scale", "0.125");
            im.Convolve(kernel);

            // Default quality of ImageMagick is 92, we need 75
            im.Quality = Quality;

            im.Write(output);
        }