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

New Post: Use command line "montage" from withing Magick.net?

$
0
0
I gave it a try myself and I found that it might just be easier to use Composite directly. It gives you a slight different image but that might also work for you. Below is an example of how you would need to translate the command from montage. I hope this will help you with other features of the library.
using (MagickImageCollection images = new MagickImageCollection())
{
  MagickReadSettings readSettings = new MagickReadSettings()
  {
    BackgroundColor = MagickColors.None, // -background none
    FillColor = MagickColors.Black, // -fill black
    Font = "Helvetica-Condensed-Light", // -font Helvetica-Condensed-Light
    FontPointsize = 26 // -pointsize 26
  };

  // label:'Foobar Controller 3.1.4.0 Installer'
  MagickImage image = new MagickImage("label:Foobar Controller 3.1.4.0 Installer", readSettings);
  image.RemoveAttribute("label"); // +set label
  images.Add(image);

  MontageSettings montageSettings = new MontageSettings()
  {
    BackgroundColor = MagickColors.None, // -background none
    Shadow = true, // -shadow
    Geometry = new MagickGeometry(5, 5, 0, 0) // -geometry +5+5
  };

  using (MagickImage result = images.Montage(montageSettings))
  {
    result.Write("test_v3.png");
  }
}
And this is the alternative solution:
MagickReadSettings readSettings = new MagickReadSettings()
{
  BackgroundColor = MagickColors.None,
  FillColor = MagickColors.Black,
  Font = "Helvetica-Condensed-Light",
  FontPointsize = 26
};

MagickImage label = new MagickImage("label:Foobar Controller 3.1.4.0 Installer", readSettings);
using (MagickImage shadow = label.Clone())
{
  // This is what is happening under the hood.
  shadow.Shadow(5, 5, 2.0, new Percentage(80), MagickColors.Black);
  shadow.Composite(label, CompositeOperator.Over);
  shadow.Write("test_v3.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>