Help converting these IM commands to Magick.NET
Posted: 2017-02-22T00:58:19-07:00
Hello, I am a new user of ImageMagick and Magick.Net.
A lot of people recommand me to use IM and Magick.Net to perform image operations.
My goal is to remove Greenscreen from images. So I found IM script on Internet that gave me a basis but I don't manage to convert it to Magick.net.
I hope somebody could help me.
I have convert it to this but it can't convert this part
Thanks for any help.
A lot of people recommand me to use IM and Magick.Net to perform image operations.
My goal is to remove Greenscreen from images. So I found IM script on Internet that gave me a basis but I don't manage to convert it to Magick.net.
I hope somebody could help me.
Code: Select all
magick convert greenscreen.jpg -alpha set ( +clone -blur 0x5 -colorspace Lab -channel R -evaluate set 50%% +channel -colorspace sRGB +dither -colors 30 -fuzz 15%% -fill None -draw "alpha 0,0 replace" -channel A -negate +channel ) -compose copyopacity -composite -filter Gaussian -resize 10%% -define filter:sigma=8.9 -resize 1000%% -alpha off gb_1.png
Code: Select all
+dither -colors 30 -fuzz 15%% -fill None -draw "alpha 0,0 replace"
Code: Select all
Dim greenscreen As New ImageMagick.MagickImage(source)
greenscreen.Alpha(ImageMagick.AlphaOption.On)
Using clone As ImageMagick.MagickImage = greenscreen.Clone
clone.Blur(0, 5)
clone.ColorSpace = ImageMagick.ColorSpace.Lab
clone.Evaluate(ImageMagick.Channels.Red, ImageMagick.EvaluateOperator.Set, New ImageMagick.Percentage(50))
clone.ColorSpace = ImageMagick.ColorSpace.sRGB
'+dither
'-colors 30
'-fuzz 15%%
'-fill None
'-draw "alpha 0,0 replace"
Dim settings As New ImageMagick.QuantizeSettings()
settings.Colors = 30
settings.DitherMethod = ImageMagick.DitherMethod.No
clone.Quantize(settings)
clone.ColorFuzz = New ImageMagick.Percentage(15)
Dim FC As New ImageMagick.DrawableFillColor(Color.Transparent)
clone.Draw(FC)
Dim DA As New ImageMagick.DrawableAlpha(0, 0, ImageMagick.PaintMethod.Replace)
clone.Draw(DA)
clone.Negate(ImageMagick.Channels.Alpha)
'-compose copyopacity -composite
'
greenscreen.Composite(clone, ImageMagick.CompositeOperator.Copy)
End Using
greenscreen.Resize(New ImageMagick.Percentage(10))
greenscreen.GaussianBlur(8, 9)
greenscreen.Resize(New ImageMagick.Percentage(1000))
greenscreen.Alpha(ImageMagick.AlphaOption.Off)