Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Convert command to .NET

$
0
0
This convert command should render a pencil sketch from the source image.

convert source.jpg
-clone 0 -modulate 100,0,100
-clone 1 -negate -blur 0x4
-clone 1 -clone 2 -compose color_dodge -composite -level 20x100%
-clone 3 -alpha set -channel a -evaluate set 100% +channel
-clone 3 -clone 4 -compose multiply -composite
-clone 0 -modulate 100,100,100
-delete 0-4 -compose screen -composite dest.jpg

I want to use the .NET API instead and tried the following. Tried reading documents and googled, but it seems my understanding on how to convert it is lacking anyhow as it only results in a black image.

var image = new MagickImage("source.jpg");
var clone0 = image.Clone();
clone0.Modulate(100, 0, 100);
clone0.Negate();
clone0.Blur(Channels.Yellow);
clone0.Write("clone0.jpg");
var clone2 = clone0.Clone();
clone2.Compose = CompositeOperator.ColorDodge;
clone2.Composite(clone0, Gravity.Center);
clone2.Level(20, 100);
clone2.Write("clone2.jpg");
var clone3 = clone2.Clone();
clone3.Alpha(AlphaOption.Set);
clone3.Evaluate(Channels.All, EvaluateOperator.Set, 100);
clone3.Write("clone3.jpg");
var clone4 = clone3.Clone();
clone4.Compose = CompositeOperator.Multiply;
clone4.Composite(clone3, Gravity.Center);
clone4.Write("clone4.jpg");
clone0.Modulate(100, 100, 100);
clone0.Compose = CompositeOperator.Screen;
clone0.Composite(clone4, Gravity.Center);
clone0.Write("dest.jpg");

Can someone help out or give pointers in the right direction (or is there a better way to solve this, like converting to MagickScript somehow)?

Viewing all articles
Browse latest Browse all 3693

Trending Articles