blob: 1f662829f68056b1fbc80be32512166380950403 [file] [log] [blame]
cristy29dc8652015-05-12 16:26:21 +00001<!DOCTYPE html>
cristy44443b92015-05-05 00:06:07 +00002<html lang="en">
cristy06f63f22012-10-31 00:50:07 +00003<head>
cristy44443b92015-05-05 00:06:07 +00004 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1">
cristyffb69ed2010-12-25 00:06:48 +00007 <title>ImageMagick: MagickCore, C API for ImageMagick: Paint on an Image</title>
cristy44443b92015-05-05 00:06:07 +00008 <meta http-equiv="content-language" content="en-US">
9 <meta http-equiv="content-type" content="text/html; charset=utf-8">
10 <meta http-equiv="reply-to" content="magick-users@imagemagick.org">
11 <meta name="application-name" content="ImageMagick">
12 <meta name="description" content="ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.">
13 <meta name="application-url" content="http://www.imagemagick.org">
14 <meta name="generator" content="PHP">
15 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, paint, on, an, image, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert">
16 <meta name="rating" content="GENERAL">
17 <meta name="robots" content="INDEX, FOLLOW">
18 <meta name="generator" content="ImageMagick Studio LLC">
19 <meta name="author" content="ImageMagick Studio LLC">
20 <meta name="revisit-after" content="2 DAYS">
21 <meta name="resource-type" content="document">
cristy4e638cd2015-05-07 16:47:40 +000022 <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
cristy44443b92015-05-05 00:06:07 +000023 <meta name="distribution" content="Global">
24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
cristy2f563d42015-05-06 23:36:51 +000025 <link rel="icon" href="../images/wand.png">
26 <link rel="shortcut icon" href="../images/wand.ico" type="images/x-icon">
27 <link rel="stylesheet" href="../css/bootstrap.min.css">
28 <link rel="stylesheet" href="../css/magick.css">
cristy06f63f22012-10-31 00:50:07 +000029</head>
30
cristy44443b92015-05-05 00:06:07 +000031<body>
cristy06f63f22012-10-31 00:50:07 +000032<div class="main">
cristy44443b92015-05-05 00:06:07 +000033<div class="magick-masthead">
34 <div class="container">
35 <script type="text/javascript">
36 <!--
37 google_ad_client = "pub-3129977114552745";
38 google_ad_slot = "5439289906";
39 google_ad_width = 728;
40 google_ad_height = 90;
41 //-->
42 </script>
43 <center><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
44 </script></center>
45 <nav class="magick-nav">
cristy2f563d42015-05-06 23:36:51 +000046 <a class="magick-nav-item " href="../index.html">Home</a>
cristy38185362015-05-07 20:09:56 +000047 <a class="magick-nav-item " href="../binary-releases.html">Downloads</a>
48 <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
49 <a class="magick-nav-item " href="../command-line-options.html">Options</a>
50 <a class="magick-nav-item " href="api.html">Development</a>
cristy44443b92015-05-05 00:06:07 +000051 <a class="magick-nav-item" href="http://www.imagemagick.org/discourse-server/">Community</a>
cristy82a2ff22015-05-12 16:41:32 +000052 <a class="magick-nav-item pull-right " href="http://www.imagemagick.org/script/search.php">Search</a>
cristy44443b92015-05-05 00:06:07 +000053 </nav>
54 </div>
55</div>
56<div class="container">
cristy4e638cd2015-05-07 16:47:40 +000057<div class="magick-header">
cristy44443b92015-05-05 00:06:07 +000058<p class="text-center"><a href="paint.html#FloodfillPaintImage">FloodfillPaintImage</a><a href="paint.html#OilPaintImage">OilPaintImage</a><a href="paint.html#OpaquePaintImage">OpaquePaintImage</a><a href="paint.html#TransparentPaintImage">TransparentPaintImage</a><a href="paint.html#TransparentPaintImageChroma">TransparentPaintImageChroma</a></p>
cristy06f63f22012-10-31 00:50:07 +000059
cristy20398432011-08-11 01:31:50 +000060<h2><a href="http://www.imagemagick.org/api/MagickCore/paint_8c.html" id="FloodfillPaintImage">FloodfillPaintImage</a></h2>
cristy20398432011-08-11 01:31:50 +000061
62<p>FloodfillPaintImage() changes the color value of any pixel that matches target and is an immediate neighbor. If the method FillToBorderMethod is specified, the color value is changed for any neighbor pixel that does not match the bordercolor member of image.</p>
63
cristy82a2ff22015-05-12 16:41:32 +000064<p>By default target must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. The fuzz member of image defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color for the purposes of the floodfill.</p>
cristy20398432011-08-11 01:31:50 +000065
66<p>The format of the FloodfillPaintImage method is:</p>
67
cristy44443b92015-05-05 00:06:07 +000068<pre class="text">
69MagickBooleanType FloodfillPaintImage(Image *image,
cristy82a2ff22015-05-12 16:41:32 +000070 const ChannelType channel,const DrawInfo *draw_info,
71 const MagickPixelPacket target,const ssize_t x_offset,
72 const ssize_t y_offset,const MagickBooleanType invert)
cristy20398432011-08-11 01:31:50 +000073</pre>
74
75<p>A description of each parameter follows:</p>
76
cristy44443b92015-05-05 00:06:07 +000077<dd>
78</dd>
cristy20398432011-08-11 01:31:50 +000079
cristy44443b92015-05-05 00:06:07 +000080<dd> </dd>
81<dl class="dl-horizontal">
82<dt>image</dt>
83<dd>the image. </dd>
cristy20398432011-08-11 01:31:50 +000084
cristy44443b92015-05-05 00:06:07 +000085<dd> </dd>
cristy82a2ff22015-05-12 16:41:32 +000086<dt>channel</dt>
87<dd>the channel(s). </dd>
88
89<dd> </dd>
cristy44443b92015-05-05 00:06:07 +000090<dt>draw_info</dt>
91<dd>the draw info. </dd>
cristy20398432011-08-11 01:31:50 +000092
cristy44443b92015-05-05 00:06:07 +000093<dd> </dd>
94<dt>target</dt>
95<dd>the RGB value of the target color. </dd>
cristy20398432011-08-11 01:31:50 +000096
cristy44443b92015-05-05 00:06:07 +000097<dd> </dd>
98<dt>x_offset,y_offset</dt>
99<dd>the starting location of the operation. </dd>
cristy20398432011-08-11 01:31:50 +0000100
cristy44443b92015-05-05 00:06:07 +0000101<dd> </dd>
102<dt>invert</dt>
103<dd>paint any pixel that does not match the target color. </dd>
cristy20398432011-08-11 01:31:50 +0000104
cristy44443b92015-05-05 00:06:07 +0000105<dd> </dd>
106</dl>
cristy20398432011-08-11 01:31:50 +0000107<h2><a href="http://www.imagemagick.org/api/MagickCore/paint_8c.html" id="OilPaintImage">OilPaintImage</a></h2>
cristy20398432011-08-11 01:31:50 +0000108
109<p>OilPaintImage() applies a special effect filter that simulates an oil painting. Each pixel is replaced by the most frequent color occurring in a circular region defined by radius.</p>
110
111<p>The format of the OilPaintImage method is:</p>
112
cristy44443b92015-05-05 00:06:07 +0000113<pre class="text">
114Image *OilPaintImage(const Image *image,const double radius,
cristy82a2ff22015-05-12 16:41:32 +0000115 ExceptionInfo *exception)
cristy20398432011-08-11 01:31:50 +0000116</pre>
117
118<p>A description of each parameter follows:</p>
119
cristy44443b92015-05-05 00:06:07 +0000120<dd>
121</dd>
cristy20398432011-08-11 01:31:50 +0000122
cristy44443b92015-05-05 00:06:07 +0000123<dd> </dd>
124<dl class="dl-horizontal">
125<dt>image</dt>
126<dd>the image. </dd>
cristy20398432011-08-11 01:31:50 +0000127
cristy44443b92015-05-05 00:06:07 +0000128<dd> </dd>
129<dt>radius</dt>
130<dd>the radius of the circular neighborhood. </dd>
cristy20398432011-08-11 01:31:50 +0000131
cristy44443b92015-05-05 00:06:07 +0000132<dd> </dd>
cristy44443b92015-05-05 00:06:07 +0000133<dt>exception</dt>
134<dd>return any errors or warnings in this structure. </dd>
135
136<dd> </dd>
137</dl>
cristy20398432011-08-11 01:31:50 +0000138<h2><a href="http://www.imagemagick.org/api/MagickCore/paint_8c.html" id="OpaquePaintImage">OpaquePaintImage</a></h2>
cristy20398432011-08-11 01:31:50 +0000139
cristy82a2ff22015-05-12 16:41:32 +0000140<p>OpaquePaintImage() changes any pixel that matches color with the color defined by fill.</p>
cristy20398432011-08-11 01:31:50 +0000141
cristy82a2ff22015-05-12 16:41:32 +0000142<p>By default color must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. Fuzz defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color.</p>
cristy20398432011-08-11 01:31:50 +0000143
144<p>The format of the OpaquePaintImage method is:</p>
145
cristy44443b92015-05-05 00:06:07 +0000146<pre class="text">
cristy82a2ff22015-05-12 16:41:32 +0000147MagickBooleanType OpaquePaintImage(Image *image,
148 const PixelPacket *target,const PixelPacket *fill,
149 const MagickBooleanType invert)
150MagickBooleanType OpaquePaintImageChannel(Image *image,
151 const ChannelType channel,const PixelPacket *target,
152 const PixelPacket *fill,const MagickBooleanType invert)
cristy20398432011-08-11 01:31:50 +0000153</pre>
154
155<p>A description of each parameter follows:</p>
156
cristy44443b92015-05-05 00:06:07 +0000157<dd>
158</dd>
cristy20398432011-08-11 01:31:50 +0000159
cristy44443b92015-05-05 00:06:07 +0000160<dd> </dd>
161<dl class="dl-horizontal">
162<dt>image</dt>
163<dd>the image. </dd>
cristy20398432011-08-11 01:31:50 +0000164
cristy44443b92015-05-05 00:06:07 +0000165<dd> </dd>
cristy82a2ff22015-05-12 16:41:32 +0000166<dt>channel</dt>
167<dd>the channel(s). </dd>
168
169<dd> </dd>
cristy44443b92015-05-05 00:06:07 +0000170<dt>target</dt>
171<dd>the RGB value of the target color. </dd>
cristy20398432011-08-11 01:31:50 +0000172
cristy44443b92015-05-05 00:06:07 +0000173<dd> </dd>
174<dt>fill</dt>
175<dd>the replacement color. </dd>
cristy20398432011-08-11 01:31:50 +0000176
cristy44443b92015-05-05 00:06:07 +0000177<dd> </dd>
178<dt>invert</dt>
179<dd>paint any pixel that does not match the target color. </dd>
cristy20398432011-08-11 01:31:50 +0000180
cristy44443b92015-05-05 00:06:07 +0000181<dd> </dd>
182</dl>
cristy20398432011-08-11 01:31:50 +0000183<h2><a href="http://www.imagemagick.org/api/MagickCore/paint_8c.html" id="TransparentPaintImage">TransparentPaintImage</a></h2>
cristy20398432011-08-11 01:31:50 +0000184
185<p>TransparentPaintImage() changes the opacity value associated with any pixel that matches color to the value defined by opacity.</p>
186
cristy82a2ff22015-05-12 16:41:32 +0000187<p>By default color must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. Fuzz defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color.</p>
cristy20398432011-08-11 01:31:50 +0000188
189<p>The format of the TransparentPaintImage method is:</p>
190
cristy44443b92015-05-05 00:06:07 +0000191<pre class="text">
192MagickBooleanType TransparentPaintImage(Image *image,
cristy82a2ff22015-05-12 16:41:32 +0000193 const MagickPixelPacket *target,const Quantum opacity,
194 const MagickBooleanType invert)
cristy20398432011-08-11 01:31:50 +0000195</pre>
196
197<p>A description of each parameter follows:</p>
198
cristy44443b92015-05-05 00:06:07 +0000199<dd>
200</dd>
cristy20398432011-08-11 01:31:50 +0000201
cristy44443b92015-05-05 00:06:07 +0000202<dd> </dd>
203<dl class="dl-horizontal">
204<dt>image</dt>
205<dd>the image. </dd>
cristy20398432011-08-11 01:31:50 +0000206
cristy44443b92015-05-05 00:06:07 +0000207<dd> </dd>
208<dt>target</dt>
209<dd>the target color. </dd>
cristy20398432011-08-11 01:31:50 +0000210
cristy44443b92015-05-05 00:06:07 +0000211<dd> </dd>
212<dt>opacity</dt>
213<dd>the replacement opacity value. </dd>
cristy20398432011-08-11 01:31:50 +0000214
cristy44443b92015-05-05 00:06:07 +0000215<dd> </dd>
216<dt>invert</dt>
217<dd>paint any pixel that does not match the target color. </dd>
218
cristy44443b92015-05-05 00:06:07 +0000219<dd> </dd>
220</dl>
cristy20398432011-08-11 01:31:50 +0000221<h2><a href="http://www.imagemagick.org/api/MagickCore/paint_8c.html" id="TransparentPaintImageChroma">TransparentPaintImageChroma</a></h2>
cristy20398432011-08-11 01:31:50 +0000222
223<p>TransparentPaintImageChroma() changes the opacity value associated with any pixel that matches color to the value defined by opacity.</p>
224
cristy82a2ff22015-05-12 16:41:32 +0000225<p>As there is one fuzz value for the all the channels, the TransparentPaintImage() API is not suitable for the operations like chroma, where the tolerance for similarity of two color component (RGB) can be different, Thus we define this method take two target pixels (one low and one hight) and all the pixels of an image which are lying between these two pixels are made transparent.</p>
cristy20398432011-08-11 01:31:50 +0000226
cristy82a2ff22015-05-12 16:41:32 +0000227<p>The format of the TransparentPaintImage method is:</p>
cristy20398432011-08-11 01:31:50 +0000228
cristy44443b92015-05-05 00:06:07 +0000229<pre class="text">
cristy82a2ff22015-05-12 16:41:32 +0000230MagickBooleanType TransparentPaintImage(Image *image,
231 const MagickPixelPacket *low,const MagickPixelPacket *hight,
232 const Quantum opacity,const MagickBooleanType invert)
cristy20398432011-08-11 01:31:50 +0000233</pre>
234
235<p>A description of each parameter follows:</p>
236
cristy44443b92015-05-05 00:06:07 +0000237<dd>
238</dd>
cristy20398432011-08-11 01:31:50 +0000239
cristy44443b92015-05-05 00:06:07 +0000240<dd> </dd>
241<dl class="dl-horizontal">
242<dt>image</dt>
243<dd>the image. </dd>
cristy20398432011-08-11 01:31:50 +0000244
cristy44443b92015-05-05 00:06:07 +0000245<dd> </dd>
246<dt>low</dt>
247<dd>the low target color. </dd>
cristy20398432011-08-11 01:31:50 +0000248
cristy44443b92015-05-05 00:06:07 +0000249<dd> </dd>
250<dt>high</dt>
251<dd>the high target color. </dd>
cristy20398432011-08-11 01:31:50 +0000252
cristy44443b92015-05-05 00:06:07 +0000253<dd> </dd>
254<dt>opacity</dt>
255<dd>the replacement opacity value. </dd>
cristy20398432011-08-11 01:31:50 +0000256
cristy44443b92015-05-05 00:06:07 +0000257<dd> </dd>
258<dt>invert</dt>
259<dd>paint any pixel that does not match the target color. </dd>
cristy06f63f22012-10-31 00:50:07 +0000260
cristy44443b92015-05-05 00:06:07 +0000261<dd> </dd>
262</dl>
cristy06f63f22012-10-31 00:50:07 +0000263</div>
cristy44443b92015-05-05 00:06:07 +0000264 <footer class="magick-footer">
cristy82a2ff22015-05-12 16:41:32 +0000265 <div class="magick-nav-item pull-left">
cristy38185362015-05-07 20:09:56 +0000266 <a href="../support.html">Donate</a>
cristy44443b92015-05-05 00:06:07 +0000267 </div>
cristy38185362015-05-07 20:09:56 +0000268 <p><a href="../sitemap.html">Sitemap</a>
269 <a href="../links.html">Related</a>
cristy44443b92015-05-05 00:06:07 +0000270 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a>
271 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
272 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
273</p>
274 <p><a href="paint.html#">Back to top</a>
cristyabed55c2015-05-06 17:07:00 +0000275 <a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p>
cristy4e638cd2015-05-07 16:47:40 +0000276 <p class="small">© 1999-2015 ImageMagick Studio LLC</p>
cristy44443b92015-05-05 00:06:07 +0000277 </footer>
278</div><!-- /.container -->
cristy06f63f22012-10-31 00:50:07 +0000279
cristy44443b92015-05-05 00:06:07 +0000280 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
cristy2f563d42015-05-06 23:36:51 +0000281 <script src="../js/bootstrap.min.js"></script>
cristy44443b92015-05-05 00:06:07 +0000282 <script type="text/javascript">
cristy82a2ff22015-05-12 16:41:32 +0000283 /* <![CDATA[ */
cristy44443b92015-05-05 00:06:07 +0000284 (function() {
285 var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
286 s.type = 'text/javascript';
287 s.async = true;
288 s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
289 t.parentNode.insertBefore(s, t);
290 })();
cristy82a2ff22015-05-12 16:41:32 +0000291 /* ]]> */
cristy44443b92015-05-05 00:06:07 +0000292 </script>
cristy44cbd482013-08-04 20:53:36 +0000293</div>
cristy06f63f22012-10-31 00:50:07 +0000294</body>
cristy5a367e42015-05-05 12:39:18 +0000295</html>