This project has moved and is read-only. For the latest updates, please go here.

Use command line "montage" from withing

Oct 21, 2016 at 5:25 PM
Edited Oct 21, 2016 at 5:25 PM
I am new to but I am trying to make a file generator. I have had it work fine from within the Linux command line, but I need to make a .net app for use by others that don't have access to linux, or the web.

Doing something like:
montage -background none -fill black -font Helvetica-Condensed-Light -pointsize 26 label:'Foobar Controller Installer' +set label -shadow -geometry +5+5 test_v3.png
Is what I would like to have (those dimensions as well) within the
using (MagickImage image = new MagickImage(new MagickColor("#000000"), 419, 39))
                new Drawables()
                // Draw text on the image
but I am rather confused in how I can accomplish this.

Any advice is greatly appreciated.
Oct 21, 2016 at 11:47 PM
The MagickImageCollection class has a Montage method with a MontageSettings argument. Can you give that a try?
Oct 24, 2016 at 3:29 PM
Can you provide additional information on its initiation, I am very unfamiliar with this framework and the documentation seems to be minimal.
Oct 24, 2016 at 10:15 PM
Edited Oct 24, 2016 at 10:18 PM
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 Installer'
  MagickImage image = new MagickImage("label:Foobar Controller Installer", readSettings);
  image.RemoveAttribute("label"); // +set label

  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))
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 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);
Oct 25, 2016 at 3:07 PM
Am I missing a dependency? I am able to add the Magick.NET-Q8-x64.dll but not the Magick.NET-Q8-x64.Native.dll saying A reference to 'C:\Users\jweinraub\Desktop\IM\net40-client\Magick.NET\Magick.NET-Q8-x64.Native.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.
Oct 25, 2016 at 6:05 PM
The Magick.NET-Q8-x64.Native.dll file should be copied to your bin folder. It needs to be in the same location as the Magick.NET-Q8-x64.dll file but you don't need to add a reference to it.
Oct 25, 2016 at 6:29 PM
Ah cool! Thank you so much! Now I can tweak this for my needs.