Removing clipping mask and apply featuring/antialiasing
Posted: 2018-06-19T02:20:21-07:00
Hi all,
I am trying to use Magick.Net to remove a clipping-mask (transparent background) and ably featuring/antialiasing for smoothing of the edges.
I have install ImageMagick locally and got the following command to do what I require:
(unix syntax)
(windows syntax)
The code I have made in C# is the flowing:
But the problem is that the C# code leave a white boarder around the image, can anyone see what I am doing wrong?
Images for testing is available at the following post: viewtopic.php?f=22&t=34049
Thank you all in advance!
I am trying to use Magick.Net to remove a clipping-mask (transparent background) and ably featuring/antialiasing for smoothing of the edges.
I have install ImageMagick locally and got the following command to do what I require:
(unix syntax)
Code: Select all
magick identify -quiet -format "%[8BIM:1999,2998:#1]" image.jpg |\
magick -quiet image.jpg \( - -alpha off -negate -morphology erode diamond:1 -blur 0x1 -level 50x100% \) \
-alpha off -compose copy_opacity -composite \
result.png
Code: Select all
magick identify -quiet -format "%[8BIM:1999,2998:#1]" image.jpg |^
magick -quiet image.jpg ( - -alpha off -negate -morphology erode diamond:1 -blur 0x1 -level 50x100% ) ^
-alpha off -compose copy_opacity -composite ^
result.png
Code: Select all
using (MagickImage image = new MagickImage(bytes))
{
using (MagickImage image2 = new MagickImage(bytes))
{
image2.Alpha(AlphaOption.Off);
image2.Negate();
image2.Morphology(MorphologyMethod.Erode, Kernel.Diamond, 1);
image2.Blur();
image2.Level(50, 100);
image.Composite(image2, CompositeOperator.CopyAlpha);
image.Write(AppDomain.CurrentDomain.BaseDirectory + "\\Image.png");
}
}
Images for testing is available at the following post: viewtopic.php?f=22&t=34049
Thank you all in advance!