Skip to content

Is there a way to use the patterns built in to ImageMagick #654

Answered by dlemstra
cstrachan88 asked this question in Help
Discussion options

You must be logged in to vote

You can use the pattern as the filename in the constructor of a MagickImage:

using (var image = new MagickImage("pattern:RIGHT45", 64, 64))
{
    image.Write("output.png");
}

And for the second command you will need to use a MagickImageCollection:

using (var images = new MagickImageCollection())
{
    images.Add(new MagickImage("img.png"));

    var right = new MagickImage("pattern:RIGHT45", 64, 64);
    right.Transparent(MagickColors.White);
    images.Add(right);

    using (var output = images.Flatten())
    {
        output.Write("output.png");
    }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cstrachan88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants