blob: 71eb426e08649bff11d856b10fa6909fd09087e1 [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: Constitute 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:, constitute, 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>
cristyea2793e2015-05-31 16:52:26 +000047 <a class="magick-nav-item " href="../binary-releases.html">Download</a>
cristy38185362015-05-07 20:09:56 +000048 <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>
cristyea2793e2015-05-31 16:52:26 +000050 <a class="magick-nav-item " href="../resources.html">Resources</a>
51 <a class="magick-nav-item " href="api.html">Develop</a>
cristy5b8fe762015-06-09 16:24:03 +000052 <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
cristya1890f02015-05-15 23:32:44 +000053 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
cristy44443b92015-05-05 00:06:07 +000054 </nav>
55 </div>
56</div>
57<div class="container">
cristy4e638cd2015-05-07 16:47:40 +000058<div class="magick-header">
cristy5b8fe762015-06-09 16:24:03 +000059<p class="text-center"><a href="constitute.html#"></a></p>
cristy06f63f22012-10-31 00:50:07 +000060
cristycecc9492015-06-09 16:53:50 +000061<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="ConstituteImage">ConstituteImage</a></h2>
62
63<p>ConstituteImage() returns an image from the pixel data you supply. The pixel data must be in scanline order top-to-bottom. The data can be char, short int, int, float, or double. Float and double require the pixels to be normalized [0..1], otherwise [0..QuantumRange]. For example, to create a 640x480 image from unsigned red-green-blue character data, use:</p>
64
65<pre class="text">
66image = ConstituteImage(640,480,"RGB",CharPixel,pixels,&amp;exception);
67</pre>
68
69<p>The format of the ConstituteImage method is:</p>
70
71<pre class="text">
72Image *ConstituteImage(const size_t columns,const size_t rows,
73 const char *map,const StorageType storage,const void *pixels,
74 ExceptionInfo *exception)
75</pre>
76
77<p>A description of each parameter follows:</p>
78
79<dd>
80</dd>
81
82<dd> </dd>
83<dl class="dl-horizontal">
84<dt>columns</dt>
85<dd>width in pixels of the image. </dd>
86
87<dd> </dd>
88<dt>rows</dt>
89<dd>height in pixels of the image. </dd>
90
91<dd> </dd>
92<dt>map</dt>
93<dd> This string reflects the expected ordering of the pixel array. It can be any combination or order of R = red, G = green, B = blue, A = alpha (0 is transparent), O = opacity (0 is opaque), C = cyan, Y = yellow, M = magenta, K = black, I = intensity (for grayscale), P = pad. </dd>
94
95<dd> </dd>
96<dt>storage</dt>
97<dd>Define the data type of the pixels. Float and double types are expected to be normalized [0..1] otherwise [0..QuantumRange]. Choose from these types: CharPixel, DoublePixel, FloatPixel, IntegerPixel, LongPixel, QuantumPixel, or ShortPixel. </dd>
98
99<dd> </dd>
100<dt>pixels</dt>
101<dd>This array of values contain the pixel components as defined by map and type. You must preallocate this array where the expected length varies depending on the values of width, height, map, and type. </dd>
102
103<dd> </dd>
104<dt>exception</dt>
105<dd>return any errors or warnings in this structure. </dd>
106
107<dd> </dd>
108</dl>
109<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="PingImage">PingImage</a></h2>
110
111<p>PingImage() returns all the properties of an image or image sequence except for the pixels. It is much faster and consumes far less memory than ReadImage(). On failure, a NULL image is returned and exception describes the reason for the failure.</p>
112
113<p>The format of the PingImage method is:</p>
114
115<pre class="text">
116Image *PingImage(const ImageInfo *image_info,ExceptionInfo *exception)
117</pre>
118
119<p>A description of each parameter follows:</p>
120
121<dd>
122</dd>
123
124<dd> </dd>
125<dl class="dl-horizontal">
126<dt>image_info</dt>
127<dd>Ping the image defined by the file or filename members of this structure. </dd>
128
129<dd> </dd>
130<dt>exception</dt>
131<dd>return any errors or warnings in this structure. </dd>
132
133<dd> </dd>
134</dl>
135<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="PingImages">PingImages</a></h2>
136
137<p>PingImages() pings one or more images and returns them as an image list.</p>
138
139<p>The format of the PingImage method is:</p>
140
141<pre class="text">
142Image *PingImages(ImageInfo *image_info,const char *filename,
143 ExceptionInfo *exception)
144</pre>
145
146<p>A description of each parameter follows:</p>
147
148<dd>
149</dd>
150
151<dd> </dd>
152<dl class="dl-horizontal">
153<dt>image_info</dt>
154<dd>the image info. </dd>
155
156<dd> </dd>
157<dt>filename</dt>
158<dd>the image filename. </dd>
159
160<dd> </dd>
161<dt>exception</dt>
162<dd>return any errors or warnings in this structure. </dd>
163
164<dd> </dd>
165</dl>
166<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="ReadImage">ReadImage</a></h2>
167
168<p>ReadImage() reads an image or image sequence from a file or file handle. The method returns a NULL if there is a memory shortage or if the image cannot be read. On failure, a NULL image is returned and exception describes the reason for the failure.</p>
169
170<p>The format of the ReadImage method is:</p>
171
172<pre class="text">
173Image *ReadImage(const ImageInfo *image_info,ExceptionInfo *exception)
174</pre>
175
176<p>A description of each parameter follows:</p>
177
178<dd>
179</dd>
180
181<dd> </dd>
182<dl class="dl-horizontal">
183<dt>image_info</dt>
184<dd>Read the image defined by the file or filename members of this structure. </dd>
185
186<dd> </dd>
187<dt>exception</dt>
188<dd>return any errors or warnings in this structure. </dd>
189
190<dd> </dd>
191</dl>
192<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="ReadImages">ReadImages</a></h2>
193
194<p>ReadImages() reads one or more images and returns them as an image list.</p>
195
196<p>The format of the ReadImage method is:</p>
197
198<pre class="text">
199Image *ReadImages(ImageInfo *image_info,const char *filename,
200 ExceptionInfo *exception)
201</pre>
202
203<p>A description of each parameter follows:</p>
204
205<dd>
206</dd>
207
208<dd> </dd>
209<dl class="dl-horizontal">
210<dt>image_info</dt>
211<dd>the image info. </dd>
212
213<dd> </dd>
214<dt>filename</dt>
215<dd>the image filename. </dd>
216
217<dd> </dd>
218<dt>exception</dt>
219<dd>return any errors or warnings in this structure. </dd>
220
221<dd> </dd>
222</dl>
223<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="WriteImage">WriteImage</a></h2>
224
225<p>WriteImage() writes an image or an image sequence to a file or file handle. If writing to a file is on disk, the name is defined by the filename member of the image structure. WriteImage() returns MagickFalse is there is a memory shortage or if the image cannot be written. Check the exception member of image to determine the cause for any failure.</p>
226
227<p>The format of the WriteImage method is:</p>
228
229<pre class="text">
230MagickBooleanType WriteImage(const ImageInfo *image_info,Image *image,
231 ExceptionInfo *exception)
232</pre>
233
234<p>A description of each parameter follows:</p>
235
236<dd>
237</dd>
238
239<dd> </dd>
240<dl class="dl-horizontal">
241<dt>image_info</dt>
242<dd>the image info. </dd>
243
244<dd> </dd>
245<dt>image</dt>
246<dd>the image. </dd>
247
248<dd> </dd>
249<dt>exception</dt>
250<dd>return any errors or warnings in this structure. </dd>
251
252<dd> </dd>
253</dl>
254<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="WriteImages">WriteImages</a></h2>
255
256<p>WriteImages() writes an image sequence into one or more files. While WriteImage() can write an image sequence, it is limited to writing the sequence into a single file using a format which supports multiple frames. WriteImages(), however, does not have this limitation, instead it generates multiple output files if necessary (or when requested). When ImageInfo's adjoin flag is set to MagickFalse, the file name is expected to include a printf-style formatting string for the frame number (e.g. "image02d.png").</p>
257
258<p>The format of the WriteImages method is:</p>
259
260<pre class="text">
261MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,
262 const char *filename,ExceptionInfo *exception)
263</pre>
264
265<p>A description of each parameter follows:</p>
266
267<dd>
268</dd>
269
270<dd> </dd>
271<dl class="dl-horizontal">
272<dt>image_info</dt>
273<dd>the image info. </dd>
274
275<dd> </dd>
276<dt>images</dt>
277<dd>the image list. </dd>
278
279<dd> </dd>
280<dt>filename</dt>
281<dd>the image filename. </dd>
282
283<dd> </dd>
284<dt>exception</dt>
285<dd>return any errors or warnings in this structure. </dd>
286
287<dd> </dd>
288</dl>
cristy06f63f22012-10-31 00:50:07 +0000289</div>
cristy44443b92015-05-05 00:06:07 +0000290 <footer class="magick-footer">
cristy82a2ff22015-05-12 16:41:32 +0000291 <div class="magick-nav-item pull-left">
cristy38185362015-05-07 20:09:56 +0000292 <a href="../support.html">Donate</a>
cristy44443b92015-05-05 00:06:07 +0000293 </div>
cristy38185362015-05-07 20:09:56 +0000294 <p><a href="../sitemap.html">Sitemap</a>
295 <a href="../links.html">Related</a>
cristy44443b92015-05-05 00:06:07 +0000296 <a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a>
cristyea2793e2015-05-31 16:52:26 +0000297 <a href="http://jqmagick.imagemagick.org/">JqMagick</a>
cristy44443b92015-05-05 00:06:07 +0000298</p>
299 <p><a href="constitute.html#">Back to top</a>
cristyea2793e2015-05-31 16:52:26 +0000300 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
cristy5b8fe762015-06-09 16:24:03 +0000301 <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
cristya1890f02015-05-15 23:32:44 +0000302 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
cristy44443b92015-05-05 00:06:07 +0000303 </footer>
304</div><!-- /.container -->
cristy06f63f22012-10-31 00:50:07 +0000305
cristy44443b92015-05-05 00:06:07 +0000306 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
cristy2f563d42015-05-06 23:36:51 +0000307 <script src="../js/bootstrap.min.js"></script>
cristy44443b92015-05-05 00:06:07 +0000308 <script type="text/javascript">
cristy82a2ff22015-05-12 16:41:32 +0000309 /* <![CDATA[ */
cristy44443b92015-05-05 00:06:07 +0000310 (function() {
311 var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
312 s.type = 'text/javascript';
313 s.async = true;
314 s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
315 t.parentNode.insertBefore(s, t);
316 })();
cristy82a2ff22015-05-12 16:41:32 +0000317 /* ]]> */
cristy44443b92015-05-05 00:06:07 +0000318 </script>
cristy44cbd482013-08-04 20:53:36 +0000319</div>
cristy06f63f22012-10-31 00:50:07 +0000320</body>
cristy5a367e42015-05-05 12:39:18 +0000321</html>