How to achieve it by IM C API

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
ospf
Posts: 3
Joined: 2018-03-28T10:15:29-07:00
Authentication code: 1152

How to achieve it by IM C API

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to achieve it by IM C API

Post by snibgo »

Which C API?
snibgo's IM pages: im.snibgo.com
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to achieve it by IM C API

Post by magick »

There are two, MagickCore and MagickWand. We recommend MagickWand.
ospf
Posts: 3
Joined: 2018-03-28T10:15:29-07:00
Authentication code: 1152

Re: How to achieve it by IM C API

Post 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。
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to achieve it by IM C API

Post 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
ospf
Posts: 3
Joined: 2018-03-28T10:15:29-07:00
Authentication code: 1152

Re: How to achieve it by IM C API

Post 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
Post Reply