Gradient direction
Posted: 2018-07-03T03:31:12-07:00
See following ImageMagick command (taken from https://www.imagemagick.org/script/gradient.php)
I've managed to translate it to .NET, except the gradient:direction part
I've tried various things as seen in the code, but none of them do what I expect it to do.
So my question is, how do I translate to Magick.NET?
Code: Select all
magick -size 256x128 -define gradient:direction=east gradient:black-white linear_gradient_east.png
I've tried various things as seen in the code, but none of them do what I expect it to do.
Code: Select all
var complete = new MagickImage(MagickColors.Transparent, 100, 100);
using (var fill = new MagickImage(MagickColors.Blue, 50, 100))
using (var gradient = new MagickImage($"gradient:blue-none", 50, 100))
{
// Rotates the entire image, not the rotation of the gradient
//gradientMask.Rotate(90);
// Does nothing
//gradient.Settings.SetDefine("gradient:direction", "east");
//gradient.Settings.SetDefine("gradient:direction", "East");
//gradient.Settings.SetDefine("direction", "east");
//gradient.Settings.SetDefine("direction", "East");
complete.Composite(fill, 0, 0, CompositeOperator.Over);
complete.Composite(gradient, 50, 0, CompositeOperator.Over);
}
// Save image etc.
complete.Dispose();
Code: Select all
-define gradient:direction=east