Converting Magick command line to C# .net
Posted: 2018-03-14T00:22:42-07:00
Hey all I am in need of some help with converting this command line to C#:
The only thing I could come up with is:
Code: Select all
convert YnTf9.png \
\( -clone 0 -blur 0x10 -gravity center -crop 400x300+0+0 +repage \) \
\( -clone 0 -resize x300 \) \
\( -clone 1 -fill white -colorize 100 \) \
\( -clone 2 -fill black -colorize 100 \) \
\( -clone 3,4 -gravity center -compose over -composite -blur 0x15 -level 40x100% \) \
-delete 0,3,4 \
\( -clone 0,2 -gravity center -compose multiply -composite \) \
-delete 0,2 +swap \
-gravity center -compose over -composite \
result.png
Code: Select all
using (MagickImage image = new MagickImage("i:/YnTf9.png"))
{
using (IMagickImage backgroundImg = image.Clone())
{
backgroundImg.Blur(0, 5);
backgroundImg.Crop(400, 300, Gravity.Center);
backgroundImg.RePage();
image.Resize(0, 300);
//Shadow
MagickImage shadowImgWhite = image.Clone();
shadowImgWhite.Colorize(MagickColors.White, new Percentage(50));
IMagickImage shadowImgBlack = image.Clone();
shadowImgBlack.Colorize(MagickColors.Black, new Percentage(50));
backgroundImg.Composite(image, Gravity.Center, CompositeOperator.SrcOver);
//TODO: Delete 0,3,4 Clones?
//TODO: Clone 0,2 -gravity, center, compose over, composit, blur, level 40x100%?
//TODO: Delete 0,2 Clones +swat
//TODO: gravity, center, compose over, composite
backgroundImg.Write("i:/result.png");
}
}