blob: f7be7a401e83324432f767c7ce6c546b6d1e84b7 [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>
Cristy36421ee2015-08-28 11:58:20 -04004
cristy29f2c972015-07-28 13:37:46 +00005 <title>ImageMagick: MagickCore, C API for ImageMagick: Constitute an Image</title>
cristy44443b92015-05-05 00:06:07 +00006 <meta http-equiv="content-type" content="text/html; charset=utf-8">
cristy44443b92015-05-05 00:06:07 +00007 <meta name="application-name" content="ImageMagick">
8 <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.">
9 <meta name="application-url" content="http://www.imagemagick.org">
10 <meta name="generator" content="PHP">
11 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, constitute, an, image, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert">
12 <meta name="rating" content="GENERAL">
13 <meta name="robots" content="INDEX, FOLLOW">
14 <meta name="generator" content="ImageMagick Studio LLC">
15 <meta name="author" content="ImageMagick Studio LLC">
16 <meta name="revisit-after" content="2 DAYS">
17 <meta name="resource-type" content="document">
cristy4e638cd2015-05-07 16:47:40 +000018 <meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
cristy44443b92015-05-05 00:06:07 +000019 <meta name="distribution" content="Global">
20 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
cristy354f1172015-07-29 14:03:48 +000021 <link rel="icon" href="../images/wand.png">
22 <link rel="shortcut icon" href="../images/wand.ico">
23 <link rel="stylesheet" href="../css/magick.html">
cristy06f63f22012-10-31 00:50:07 +000024</head>
cristy44443b92015-05-05 00:06:07 +000025<body>
cristy06f63f22012-10-31 00:50:07 +000026<div class="main">
cristy44443b92015-05-05 00:06:07 +000027<div class="magick-masthead">
28 <div class="container">
Cristy542697a2015-10-12 20:10:32 -040029 <script async="async" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3129977114552745" data-ad-slot="6345125851" data-ad-format="auto"></ins>
cristy29f2c972015-07-28 13:37:46 +000030 <script>
Cristy542697a2015-10-12 20:10:32 -040031 (adsbygoogle = window.adsbygoogle || []).push({});
cristy44443b92015-05-05 00:06:07 +000032 </script>
cristy44443b92015-05-05 00:06:07 +000033 <nav class="magick-nav">
cristy2f563d42015-05-06 23:36:51 +000034 <a class="magick-nav-item " href="../index.html">Home</a>
cristyea2793e2015-05-31 16:52:26 +000035 <a class="magick-nav-item " href="../binary-releases.html">Download</a>
cristy38185362015-05-07 20:09:56 +000036 <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
37 <a class="magick-nav-item " href="../command-line-options.html">Options</a>
cristyea2793e2015-05-31 16:52:26 +000038 <a class="magick-nav-item " href="../resources.html">Resources</a>
39 <a class="magick-nav-item " href="api.html">Develop</a>
cristy5b8fe762015-06-09 16:24:03 +000040 <a class="magick-nav-item " href="http://nextgen.imagemagick.org/script/search.php">Search</a>
cristya1890f02015-05-15 23:32:44 +000041 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
cristy44443b92015-05-05 00:06:07 +000042 </nav>
43 </div>
44</div>
45<div class="container">
cristy4e638cd2015-05-07 16:47:40 +000046<div class="magick-header">
cristy99513ee2015-06-21 00:00:03 +000047<p class="text-center"><a href="constitute.html#ConstituteImage">ConstituteImage</a><a href="constitute.html#PingImage">PingImage</a><a href="constitute.html#PingImages">PingImages</a><a href="constitute.html#ReadImage">ReadImage</a><a href="constitute.html#ReadImages">ReadImages</a><a href="constitute.html#WriteImage">WriteImage</a><a href="constitute.html#WriteImages">WriteImages</a></p>
cristy06f63f22012-10-31 00:50:07 +000048
cristycecc9492015-06-09 16:53:50 +000049<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="ConstituteImage">ConstituteImage</a></h2>
50
51<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>
52
53<pre class="text">
54image = ConstituteImage(640,480,"RGB",CharPixel,pixels,&amp;exception);
55</pre>
56
57<p>The format of the ConstituteImage method is:</p>
58
59<pre class="text">
60Image *ConstituteImage(const size_t columns,const size_t rows,
61 const char *map,const StorageType storage,const void *pixels,
62 ExceptionInfo *exception)
63</pre>
64
65<p>A description of each parameter follows:</p>
66
67<dd>
68</dd>
69
70<dd> </dd>
71<dl class="dl-horizontal">
72<dt>columns</dt>
73<dd>width in pixels of the image. </dd>
74
75<dd> </dd>
76<dt>rows</dt>
77<dd>height in pixels of the image. </dd>
78
79<dd> </dd>
80<dt>map</dt>
81<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>
82
83<dd> </dd>
84<dt>storage</dt>
85<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>
86
87<dd> </dd>
88<dt>pixels</dt>
89<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>
90
91<dd> </dd>
92<dt>exception</dt>
93<dd>return any errors or warnings in this structure. </dd>
94
95<dd> </dd>
96</dl>
97<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="PingImage">PingImage</a></h2>
98
99<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>
100
101<p>The format of the PingImage method is:</p>
102
103<pre class="text">
104Image *PingImage(const ImageInfo *image_info,ExceptionInfo *exception)
105</pre>
106
107<p>A description of each parameter follows:</p>
108
109<dd>
110</dd>
111
112<dd> </dd>
113<dl class="dl-horizontal">
114<dt>image_info</dt>
115<dd>Ping the image defined by the file or filename members of this structure. </dd>
116
117<dd> </dd>
118<dt>exception</dt>
119<dd>return any errors or warnings in this structure. </dd>
120
121<dd> </dd>
122</dl>
123<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="PingImages">PingImages</a></h2>
124
125<p>PingImages() pings one or more images and returns them as an image list.</p>
126
127<p>The format of the PingImage method is:</p>
128
129<pre class="text">
130Image *PingImages(ImageInfo *image_info,const char *filename,
131 ExceptionInfo *exception)
132</pre>
133
134<p>A description of each parameter follows:</p>
135
136<dd>
137</dd>
138
139<dd> </dd>
140<dl class="dl-horizontal">
141<dt>image_info</dt>
142<dd>the image info. </dd>
143
144<dd> </dd>
145<dt>filename</dt>
146<dd>the image filename. </dd>
147
148<dd> </dd>
149<dt>exception</dt>
150<dd>return any errors or warnings in this structure. </dd>
151
152<dd> </dd>
153</dl>
154<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="ReadImage">ReadImage</a></h2>
155
156<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>
157
158<p>The format of the ReadImage method is:</p>
159
160<pre class="text">
161Image *ReadImage(const ImageInfo *image_info,ExceptionInfo *exception)
162</pre>
163
164<p>A description of each parameter follows:</p>
165
166<dd>
167</dd>
168
169<dd> </dd>
170<dl class="dl-horizontal">
171<dt>image_info</dt>
172<dd>Read the image defined by the file or filename members of this structure. </dd>
173
174<dd> </dd>
175<dt>exception</dt>
176<dd>return any errors or warnings in this structure. </dd>
177
178<dd> </dd>
179</dl>
180<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="ReadImages">ReadImages</a></h2>
181
182<p>ReadImages() reads one or more images and returns them as an image list.</p>
183
184<p>The format of the ReadImage method is:</p>
185
186<pre class="text">
187Image *ReadImages(ImageInfo *image_info,const char *filename,
188 ExceptionInfo *exception)
189</pre>
190
191<p>A description of each parameter follows:</p>
192
193<dd>
194</dd>
195
196<dd> </dd>
197<dl class="dl-horizontal">
198<dt>image_info</dt>
199<dd>the image info. </dd>
200
201<dd> </dd>
202<dt>filename</dt>
203<dd>the image filename. </dd>
204
205<dd> </dd>
206<dt>exception</dt>
207<dd>return any errors or warnings in this structure. </dd>
208
209<dd> </dd>
210</dl>
211<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="WriteImage">WriteImage</a></h2>
212
213<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>
214
215<p>The format of the WriteImage method is:</p>
216
217<pre class="text">
218MagickBooleanType WriteImage(const ImageInfo *image_info,Image *image,
219 ExceptionInfo *exception)
220</pre>
221
222<p>A description of each parameter follows:</p>
223
224<dd>
225</dd>
226
227<dd> </dd>
228<dl class="dl-horizontal">
229<dt>image_info</dt>
230<dd>the image info. </dd>
231
232<dd> </dd>
233<dt>image</dt>
234<dd>the image. </dd>
235
236<dd> </dd>
237<dt>exception</dt>
238<dd>return any errors or warnings in this structure. </dd>
239
240<dd> </dd>
241</dl>
242<h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="WriteImages">WriteImages</a></h2>
243
244<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>
245
246<p>The format of the WriteImages method is:</p>
247
248<pre class="text">
249MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,
250 const char *filename,ExceptionInfo *exception)
251</pre>
252
253<p>A description of each parameter follows:</p>
254
255<dd>
256</dd>
257
258<dd> </dd>
259<dl class="dl-horizontal">
260<dt>image_info</dt>
261<dd>the image info. </dd>
262
263<dd> </dd>
264<dt>images</dt>
265<dd>the image list. </dd>
266
267<dd> </dd>
268<dt>filename</dt>
269<dd>the image filename. </dd>
270
271<dd> </dd>
272<dt>exception</dt>
273<dd>return any errors or warnings in this structure. </dd>
274
275<dd> </dd>
276</dl>
cristy06f63f22012-10-31 00:50:07 +0000277</div>
cristy44443b92015-05-05 00:06:07 +0000278 <footer class="magick-footer">
cristy29f2c972015-07-28 13:37:46 +0000279 <p><a href="../support.html">Donate</a>
280 <a href="../sitemap.html">Sitemap</a>
cristy38185362015-05-07 20:09:56 +0000281 <a href="../links.html">Related</a>
cristy29f2c972015-07-28 13:37:46 +0000282 <a href="../architecture.html">Architecture</a>
cristy44443b92015-05-05 00:06:07 +0000283</p>
284 <p><a href="constitute.html#">Back to top</a>
cristyea2793e2015-05-31 16:52:26 +0000285 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&amp;search=0x89AB63D48277377A">Public Key</a>
cristy5b8fe762015-06-09 16:24:03 +0000286 <a href="http://nextgen.imagemagick.org/script/contact.php">Contact Us</a></p>
Cristy36421ee2015-08-28 11:58:20 -0400287 <p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
cristy44443b92015-05-05 00:06:07 +0000288 </footer>
289</div><!-- /.container -->
cristy06f63f22012-10-31 00:50:07 +0000290
Cristy542697a2015-10-12 20:10:32 -0400291 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
cristy29f2c972015-07-28 13:37:46 +0000292 <script src="http://nextgen.imagemagick.org/js/magick.html"></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>