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

New Post: Convert command to .NET

$
0
0
Below is an how your command can be translated to Magick.NET. This is not the most efficient way to do this but it should help you to translate commands in the future. I have added a comment with the 'imagelist' at different points in the operation so you can better understand which image is being cloned. You probably also want to take a look at the Sketch method of MagickImage., This produces different results but might be interesting for you.
MagickImage logo = new MagickImage("logo:");

// ( -clone 0 -modulate 100,0,100 )
MagickImage clone0 = logo.Clone();
clone0.Modulate(100, 0, 100);

// imagelist: logo, clone0// ( -clone 1 -negate -blur 0x4 )
MagickImage clone1 = clone0.Clone();
clone1.Negate();
clone1.Blur(0, 4);

// imagelist: logo, clone0, clone1// ( -clone 1 -clone 2 -compose color_dodge -composite -level 20x100% )
MagickImage compositeClone1 = clone0.Clone();
MagickImage compositeClone2 = clone1.Clone();
compositeClone1.Composite(compositeClone2, 0, 0, CompositeOperator.ColorDodge);
compositeClone1.Level((ushort)(Quantum.Max * 0.2), Quantum.Max);

compositeClone2.Dispose(); // composite produces 1 image and discards the other// imagelist: logo, clone0, clone1, compositeClone1// ( -clone 3 -alpha set -channel a -evaluate set 100% +channel )
MagickImage alpha = compositeClone1.Clone();
alpha.Alpha(AlphaOption.Set);
alpha.Evaluate(Channels.Alpha, EvaluateOperator.Set, 0);

// imagelist: logo, clone0, clone1, compositeClone1, alpha// ( -clone 3 -clone 4 -compose multiply -composite )
MagickImage compositeClone3 = compositeClone1.Clone();
MagickImage compositeClone4 = alpha.Clone();
compositeClone3.Composite(compositeClone4, 0, 0, CompositeOperator.Multiply);

// side note: In the next version of Magick.NET you will be able to do this:// compositeClone3.Composite(compositeClone4, CompositeOperator.Multiply);

compositeClone4.Dispose();

// imagelist: logo, clone0, clone1, compositeClone1, alpha, compositeClone3// ( -clone 0 -modulate 100,0,100 )
MagickImage clone0_2 = logo.Clone();
clone0_2.Modulate(100, 100, 100);

// imagelist: logo, clone0, clone1, compositeClone1, alpha, compositeClone3, clone0_2// -delete 0-4
logo.Dispose();
clone0.Dispose();
clone1.Dispose();
compositeClone1.Dispose();
alpha.Dispose();

// imagelist: compositeClone3, clone0_2// -compose screen -composite logo.png
compositeClone3.Composite(clone0_2, 0, 0, CompositeOperator.Screen);
compositeClone3.Write("output.png");

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>