Example #1
0
        public MagickImage(int width, int height, MagickPixelWand pixelWand)
        {
            ImageMagick.EnsureInitialized();

            this.Handle = ImageMagick.NewMagickWand();
            if (this.Handle == IntPtr.Zero)
            {
                throw new Exception("Error acquiring wand.");
            }

            this.ExecuteChecked<int, int, IntPtr>(ImageMagick.MagickNewImage, width, height, pixelWand.Handle);
        }
Example #2
0
        static void Main(string[] args)
        {
            LibraryLoader.LoadLibraries();

            // test split
            Image image = new Image(@"C:\Temp\planet-hoth-wampas.jpg");
            Image[] parts = image.SplitH(100, 150);
            parts[0].Write(@"C:\Temp\temp1.png");
            parts[1].Write(@"C:\Temp\temp2.png");
            parts[2].Write(@"C:\Temp\temp3.png");

            // test tranparent
            MagickPixelWand target = new MagickPixelWand();
            target.Color = "#ffffff";
            image.Transparent(target, 0.0, 3276.8, false);
            image.Write(@"C:\Temp\temp4.png");

            // test colorspace
            image.Colorspace(ColorspaceType.GRAYColorspace);
            image.Write(@"C:\Temp\temp5.png");

            // test threshold
            image.Threshold(32768.0);
            image.Write(@"C:\Temp\temp6.png");

            // test fill
            target = new MagickPixelWand();
            target.Color = "#000000";
            MagickPixelWand fill = new MagickPixelWand();
            fill.Color = "#267F00";
            image.Fill(target, fill, 3276.8, false);
            image.Write(@"C:\Temp\temp7.png");

            //test resize
            image.Resize(100, 88, FilterType.PointFilter);
            image.Write(@"C:\Temp\temp8.png");
        }
Example #3
0
 public Image(int width, int height, MagickPixelWand pixelWand)
 {
     this.image = new MagickImage(width, height, pixelWand);
 }
Example #4
0
 public void Transparent(MagickPixelWand target, double alpha, double fuzz, bool invert)
 {
     this.image.Transparent(target, alpha, fuzz, invert);
 }
Example #5
0
 public void Rotate(MagickPixelWand background, double degrees)
 {
     this.image.Rotate(background, degrees);
     this.ResetImagePage();
 }
Example #6
0
 public void Fill(MagickPixelWand target, MagickPixelWand fill, double fuzz, bool invert)
 {
     this.image.Fill(target, fill, fuzz, invert);
 }
Example #7
0
 public void Transparent(MagickPixelWand target, double alpha, double fuzz, bool invert)
 {
     this.ExecuteChecked(ImageMagick.MagickTransparentPaintImage, target.Handle, alpha, fuzz, invert ? 1 : 0);
 }
Example #8
0
 public void Rotate(MagickPixelWand pixelWand, double degrees)
 {
     this.ExecuteChecked(ImageMagick.MagickRotateImage, pixelWand.Handle, degrees);
 }
Example #9
0
 public void Fill(MagickPixelWand target, MagickPixelWand fill, double fuzz, bool invert)
 {
     this.ExecuteChecked(ImageMagick.MagickOpaquePaintImage, target.Handle, fill.Handle, fuzz, invert ? 1 : 0);
 }