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

New Post: Magick Script & Composite

$
0
0
You can read the mask directly in the script when you specify the file name (the commented part) or you can use the 'Read' event to load the image. Below is an example that uses the Read event.

script.msl
<msl><read><virtualPixelMethodvalue=""Transparent""/><backgroundColorvalue=""Transparent""/><compositex=""0""y=""0""compose=""Darken""><!--<image fileName=""out\\futmask2.png""/>--><imageid=""mask""/></composite></read></msl>"
staticvoid ExecuteScript()
{
  MagickScript script = new MagickScript("script.msl");
  script.Read += script_Read;

  using (MagickImage test = new MagickImage(filein))
  {
    script.Execute(test);
    test.Write("out\\base2.png");
  }
}
staticvoid script_Read(object sender, ScriptReadEventArgs arguments)
{
  if (arguments.Id == "mask")
  {
    MagickImage futmask2 = new MagickImage(System.Drawing.Color.Black, 850, 340);

    string func3 = "xcercle=(i-(850)/2)/((850+50)) ; ycercle = sqrt(1-xcercle^2);  ymax=abs(xcercle)>1?0:ycercle  ;ymax";
    futmask2.Fx(func3);
    arguments.Image = futmask2;
  }
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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