예제 #1
0
        public MagickImage(MagickImage image)
        {
            ImageMagick.EnsureInitialized();

            this.Handle = ImageMagick.CloneMagickWand(image.Handle);
            if (this.Handle == IntPtr.Zero)
            {
                throw new ImageMagickException(image.Handle);
            }
        }
        public static byte[] CreateThumbnail(byte[] source, int size, out string extension, out string mimeType)
        {
            MagickImage image = new MagickImage(source);
            int newSize = Math.Min(image.Width, image.Height);
            int x = (image.Width - newSize) / 2;
            int y = (image.Height - newSize) / 2;
            image.Crop(newSize, newSize, x, y);
            image.Resize(size, size, FilterType.CubicFilter, 1);

            extension = ".jpeg";
            mimeType = "image/jpeg";

            image.Format = "JPEG";
            return image.GetBlob();
        }
예제 #3
0
 public Image(int width, int height, MagickPixelWand pixelWand)
 {
     this.image = new MagickImage(width, height, pixelWand);
 }
예제 #4
0
 /// <summary>
 /// Creates a new Image instance using the same image as passed.
 /// </summary>
 public Image(MagickImage image)
 {
     this.image = image;
 }
예제 #5
0
 /// <summary>
 /// Copies the image into a new one.
 /// </summary>
 public Image(Image image)
 {
     this.image = new MagickImage(image.image);
 }
예제 #6
0
 public Image(byte[] blob)
 {
     this.image = new MagickImage(blob);
 }
예제 #7
0
 public Image(string path)
 {
     this.image = new MagickImage(path);
 }
예제 #8
0
 public void Dispose()
 {
     this.image.Dispose();
     this.image = null;
 }
예제 #9
0
 public void CompositeImage(MagickImage sourceImage, CompositeOperator compose, int x, int y)
 {
     this.ExecuteChecked(ImageMagick.MagickCompositeImage, sourceImage.Handle, (int)compose, x, y);
 }