Page 1 of 1
How to achieve it by IM C API
Posted: 2018-03-28T10:28:06-07:00
by ospf
IM command:
convert test.png -alpha off \
-alpha set -fuzz 10% -fill none \
-draw "alpha 0,0 floodfill" \
-fill "rgba(255,255,255,1)" +opaque none \
-fill "rgba(0,0,0,1)" -opaque none \
-alpha off testDst.png
My question:
I'm a novice. How can I use IM C API on the above command, thanks.
Re: How to achieve it by IM C API
Posted: 2018-03-28T11:50:17-07:00
by snibgo
Which C API?
Re: How to achieve it by IM C API
Posted: 2018-03-28T15:31:55-07:00
by magick
There are two, MagickCore and MagickWand. We recommend MagickWand.
Re: How to achieve it by IM C API
Posted: 2018-03-28T18:50:00-07:00
by ospf
thanks,What I mean is how to use an api to implement the function of a command and what functions to use. I tried but did not succeed, give some suggestions。
Re: How to achieve it by IM C API
Posted: 2018-03-28T19:41:49-07:00
by fmw42
You have to specify which C API you want to use; otherwise, no one can tell you the appropriate commands for that API. Also please identify your IM version and platform.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at
http://www.imagemagick.org/discourse-se ... f=1&t=9620
Re: How to achieve it by IM C API
Posted: 2018-03-28T20:19:01-07:00
by ospf
System:
linux IM: ImageMagick-7 API: magicwand by c
code:
PixelWand *fillColor = NewPixelWand();
PixelSetColor(fillColor, "rgba(0,0,0,1)");
PixelSetFuzz(fillColor, img.fuzzval);
DrawSetFillColor(drawImage, fillColor);
DrawAlpha(drawImage, 0, 0, FloodfillMethod);
MagickDrawImage(image, drawImage);
I want to get a mask of the image, the above code is applied to the image, get the largest border outside the black, how to reverse the transfer of the rest of the white