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

tile

Dec 16, 2014 at 1:09 AM
So I'm trying to replicate the following in Magick.NET and I can get most of it, but I don't seem to grasp how to make the -tile with a gradient part to happen. (oh I am using Magick.Net based off of imagemagick 6 because of my previous post of the difference with transparency masking) - thanks if you have a minute to point me in the right direction.

command line command:

convert -size 320x90 canvas:none -stroke snow4 -size 1x90 -tile gradient:white-snow4 -draw "roundrectangle 16, 5, 304, 85 20,40" test.png

My C# start:
    {
        String TempFile1 = "cylindertemp1.png";
         MagickReadSettings settings = new MagickReadSettings();
        settings.Width = 320;
        settings.Height = 90;

        // Create cynlinder
        using (MagickImage image = new MagickImage("xc:none", settings))
        {
            image.StrokeColor = new MagickColor("snow4");               
            image.FillColor = new MagickColor("white");
            Drawable[] draw_this = { new DrawableRoundRectangle(16, 5, 304, 85, 20, 40) };
            image.Draw(draw_this);

            image.Write(TempFile1);
        }
    }
Dec 18, 2014 at 10:36 AM
The -tile option set the fillpattern of the image. Your command translates to this:
using (MagickImage image = new MagickImage("xc:none", 320, 90))
{
  using (MagickImage tile = new MagickImage("gradient:white-snow4", 1, 90))
  {
    image.StrokeColor = new MagickColor("snow4");
    image.FillColor = new MagickColor("white");
    image.FillPattern = tile;
    Drawable[] draw_this =
    {
       new DrawableRoundRectangle(16, 5, 304, 85, 20, 40)
    };
    image.Draw(draw_this);
  }
  image.Write(@"D:\test.png");
}
I have not tested this with the IM6 version of Magick.NET and you might notice that I use new constructor. This constructor is not yet available in Magick.NET but will be in the next release. We are also working on fixing the transparency issue from your other post (http://magick.codeplex.com/discussions/571560) in ImageMagick. That will be fixed in the next release.
Dec 19, 2014 at 12:55 AM
Thanks much for the quick reply, makes me anxious for the next release if it will fix 2 of my issues!