Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Precisely placing multiple overlapping images

$
0
0
You can do this with the Composite method of MagickImage. Below is a simple example:
using (MagickImage canvas = new MagickImage("xc:none", 100, 100))
{
  using (MagickImage red = new MagickImage("xc:red", 50, 50))
  {
    int x = 30;
    int y = 20;
    canvas.Composite(red, new MagickGeometry(x, y, red.Width, red.Height), CompositeOperator.Over);
  }

  using (MagickImage yellow = new MagickImage("xc:yellow", 100, 10))
  {
    int x = 0;
    int y = 30;
    canvas.Composite(yellow, new MagickGeometry(x, y, yellow.Width, yellow.Height), CompositeOperator.Over);
  }

  using (MagickImage purple= new MagickImage("xc:purple", 10, 100))
  {
    int x = 50;
    int y = 0;
    canvas.Composite(yellow, new MagickGeometry(x, y, purple.Width, purple.Height), CompositeOperator.Over);
  }

  canvas.Write(@"c:\test.png");
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>