Add page to docs: Cookbook showing conversion of ImageMagick commands to equivalent Magick.NET code
Hi,
I'm delving into Magick.NET for the first time, thanks so much for maintaining this amazing project. The docs are great, but I notice there are not many examples showing how command-line args in ImageMagick directly map to Magick.NET code. What do you think about adding a folder with Documentation that contains lots of "recipes" on how to convert ImageMagick commands to code? I am happy to contribute (as soon as I figure out my own issue, of course :P)
Thanks!
Most command-line args are properties or methods of either the MagickImage or the MagickImageCollection class. Not sure if it is worth the effort to do that for all the options because most of them have the exact same name. Maybe that should be written down and only add some of the exceptions to that rule? I hope you have figured out your own issue but I would love some help with that.
Another idea that has crossed my mind would be creating a website that contains visual examples of all the operations that are possible with the MagickImage and MagickImageCollection class. That should of course be generated (with magickscript) and maybe this could then also include the command line argument in the documentation. This will be a lot more work but maybe you can help me to make this possible? Maybe you could also help with this @meysamSamanpour?
I think a website is the best solution. Because many people have difficulty to translate image magic to magicimage.net code. Just consider the composite with color map. A website can be a huge help. I like this project and ready to help.
Website would be great, but I was really just thinking something along the lines of a big page with lots of examples that people can use as a reference when they're trying to translate their own queries. For example, recently I needed to turn this into Magick.NET code:
magick magickTest.jpg -white-threshold 90% -fill red -fuzz 10% -draw "color 0,0 replace" -fill white +opaque red -fill black -opaque red -blur 0x1 output.jpg
magick magickTest.jpg output.jpg -alpha Off -compose CopyOpacity -composite -white-threshold 95% -transparent white outputfinal.png
And I ended up with:
let image = new MagickImage(data)
let maskImage = new MagickImage(image.Clone())
maskImage.WhiteThreshold(Percentage(97))
maskImage.Settings.FillColor <- MagickColors.Red
maskImage.ColorFuzz <- Percentage(4)
let drawable = Drawables().Color(0.,0.,PaintMethod.Floodfill)
maskImage.Draw(drawable)
maskImage.InverseOpaque(MagickColors.Red, MagickColors.White)
maskImage.Opaque(MagickColors.Red, MagickColors.Black)
maskImage.Blur()
maskImage.Alpha(AlphaOption.Off)
maskImage.Composite(image, CompositeOperator.Copy)
maskImage.WhiteThreshold(Percentage(97))
maskImage.Transparent(MagickColors.White)
maskImage.ToByteArray(MagickFormat.Png)
So, maybe something like a page that has the command(s), the .NET code, and a description of what the person was trying to do? I figure people will probably be willing to make PRs (I know I am!). And then it can be a go-to resource when someone is trying to figure out how to use a particular command.
I see people asking these kinds of questions all over the ImageMagick forums or on SO, I think having an official repository for that knowledge would be nice.