1 2 3 4 5<!DOCTYPE html> 6<html lang="en"> 7<head> 8 <meta charset="utf-8" /> 9 <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no" /> 10 <title>MagickCore, C API: Constitute an Image @ ImageMagick</title> 11 <meta name="application-name" content="ImageMagick" /> 12 <meta name="description" content="Use ImageMagick® to create, edit, compose, or convert bitmap images. You can resize your image, crop it, change its shades and colors, add captions, among other operations." /> 13 <meta name="application-url" content="https://imagemagick.org" /> 14 <meta name="generator" content="PHP" /> 15 <meta name="keywords" content="magickcore, c, api:, 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" /> 22 <meta name="copyright" content="Copyright (c) 1999-2017 ImageMagick Studio LLC" /> 23 <meta name="distribution" content="Global" /> 24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" /> 25 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 26 <link href="constitute.html" rel="canonical" /> 27 <link href="../../images/wand.png" rel="icon" /> 28 <link href="../../images/wand.ico" rel="shortcut icon" /> 29 <link href="../assets/magick.css" rel="stylesheet" /> 30</head> 31<body> 32 <header> 33 <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> 34 <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../images/wand.ico"/></a> 35 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation"> 36 <span class="navbar-toggler-icon"></span> 37 </button> 38 39 <div class="navbar-collapse collapse" id="navbarsMagick" style=""> 40 <ul class="navbar-nav mr-auto"> 41 <li class="nav-item "> 42 <a class="nav-link" href="quantize.html">Home <span class="sr-only">(current)</span></a> 43 </li> 44 <li class="nav-item "> 45 <a class="nav-link" href="../../www/download.html">Download</a> 46 </li> 47 <li class="nav-item "> 48 <a class="nav-link" href="../../www/command-line-tools.html">Tools</a> 49 </li> 50 <li class="nav-item "> 51 <a class="nav-link" href="../../www/command-line-processing.html">Command-line</a> 52 </li> 53 <li class="nav-item "> 54 <a class="nav-link" href="../../www/resources.html">Resources</a> 55 </li> 56 <li class="nav-item "> 57 <a class="nav-link" href="../../www/develop.html">Develop</a> 58 </li> 59 <li class="nav-item"> 60 <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a> 61 </li> 62 </ul> 63 <form class="form-inline my-2 my-lg-0" action="https://imagemagick.org/script/search.php"> 64 <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search"> 65 <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button> 66 </form> 67 </div> 68 </nav> 69 <div class="container"> 70 <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" 71 style="display:block" 72 data-ad-client="ca-pub-3129977114552745" 73 data-ad-slot="6345125851" 74 data-ad-format="auto"></ins> 75 <script> 76 (adsbygoogle = window.adsbygoogle || []).push({}); 77 </script> 78 79 </div> 80 </header> 81 <main class="container"> 82 <div class="magick-template"> 83<div class="magick-header"> 84<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> 85 86<h2><a href="../../api/MagickCore/constitute_8c.html" id="ConstituteImage">ConstituteImage</a></h2> 87 88<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> 89 90<pre class="text"> 91image = ConstituteImage(640,480,"RGB",CharPixel,pixels,&exception); 92</pre> 93 94<p>The format of the ConstituteImage method is:</p> 95 96<pre class="text"> 97Image *ConstituteImage(const size_t columns,const size_t rows, 98 const char *map,const StorageType storage,const void *pixels, 99 ExceptionInfo *exception) 100</pre> 101 102<p>A description of each parameter follows:</p> 103 104<dd> 105</dd> 106 107<dd> </dd> 108<dl class="dl-horizontal"> 109<dt>columns</dt> 110<dd>width in pixels of the image. </dd> 111 112<dd> </dd> 113<dt>rows</dt> 114<dd>height in pixels of the image. </dd> 115 116<dd> </dd> 117<dt>map</dt> 118<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> 119 120<dd> </dd> 121<dt>storage</dt> 122<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> 123 124<dd> </dd> 125<dt>pixels</dt> 126<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> 127 128<dd> </dd> 129<dt>exception</dt> 130<dd>return any errors or warnings in this structure. </dd> 131 132<dd> </dd> 133</dl> 134<h2><a href="../../api/MagickCore/constitute_8c.html" id="PingImage">PingImage</a></h2> 135 136<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> 137 138<p>The format of the PingImage method is:</p> 139 140<pre class="text"> 141Image *PingImage(const ImageInfo *image_info,ExceptionInfo *exception) 142</pre> 143 144<p>A description of each parameter follows:</p> 145 146<dd> 147</dd> 148 149<dd> </dd> 150<dl class="dl-horizontal"> 151<dt>image_info</dt> 152<dd>Ping the image defined by the file or filename members of this structure. </dd> 153 154<dd> </dd> 155<dt>exception</dt> 156<dd>return any errors or warnings in this structure. </dd> 157 158<dd> </dd> 159</dl> 160<h2><a href="../../api/MagickCore/constitute_8c.html" id="PingImages">PingImages</a></h2> 161 162<p>PingImages() pings one or more images and returns them as an image list.</p> 163 164<p>The format of the PingImage method is:</p> 165 166<pre class="text"> 167Image *PingImages(ImageInfo *image_info,const char *filename, 168 ExceptionInfo *exception) 169</pre> 170 171<p>A description of each parameter follows:</p> 172 173<dd> 174</dd> 175 176<dd> </dd> 177<dl class="dl-horizontal"> 178<dt>image_info</dt> 179<dd>the image info. </dd> 180 181<dd> </dd> 182<dt>filename</dt> 183<dd>the image filename. </dd> 184 185<dd> </dd> 186<dt>exception</dt> 187<dd>return any errors or warnings in this structure. </dd> 188 189<dd> </dd> 190</dl> 191<h2><a href="../../api/MagickCore/constitute_8c.html" id="ReadImage">ReadImage</a></h2> 192 193<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> 194 195<p>The format of the ReadImage method is:</p> 196 197<pre class="text"> 198Image *ReadImage(const ImageInfo *image_info,ExceptionInfo *exception) 199</pre> 200 201<p>A description of each parameter follows:</p> 202 203<dd> 204</dd> 205 206<dd> </dd> 207<dl class="dl-horizontal"> 208<dt>image_info</dt> 209<dd>Read the image defined by the file or filename members of this structure. </dd> 210 211<dd> </dd> 212<dt>exception</dt> 213<dd>return any errors or warnings in this structure. </dd> 214 215<dd> </dd> 216</dl> 217<h2><a href="../../api/MagickCore/constitute_8c.html" id="ReadImages">ReadImages</a></h2> 218 219<p>ReadImages() reads one or more images and returns them as an image list.</p> 220 221<p>The format of the ReadImage method is:</p> 222 223<pre class="text"> 224Image *ReadImages(ImageInfo *image_info,const char *filename, 225 ExceptionInfo *exception) 226</pre> 227 228<p>A description of each parameter follows:</p> 229 230<dd> 231</dd> 232 233<dd> </dd> 234<dl class="dl-horizontal"> 235<dt>image_info</dt> 236<dd>the image info. </dd> 237 238<dd> </dd> 239<dt>filename</dt> 240<dd>the image filename. </dd> 241 242<dd> </dd> 243<dt>exception</dt> 244<dd>return any errors or warnings in this structure. </dd> 245 246<dd> </dd> 247</dl> 248<h2><a href="../../api/MagickCore/constitute_8c.html" id="WriteImage">WriteImage</a></h2> 249 250<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> 251 252<p>The format of the WriteImage method is:</p> 253 254<pre class="text"> 255MagickBooleanType WriteImage(const ImageInfo *image_info,Image *image, 256 ExceptionInfo *exception) 257</pre> 258 259<p>A description of each parameter follows:</p> 260 261<dd> 262</dd> 263 264<dd> </dd> 265<dl class="dl-horizontal"> 266<dt>image_info</dt> 267<dd>the image info. </dd> 268 269<dd> </dd> 270<dt>image</dt> 271<dd>the image. </dd> 272 273<dd> </dd> 274<dt>exception</dt> 275<dd>return any errors or warnings in this structure. </dd> 276 277<dd> </dd> 278</dl> 279<h2><a href="../../api/MagickCore/constitute_8c.html" id="WriteImages">WriteImages</a></h2> 280 281<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> 282 283<p>The format of the WriteImages method is:</p> 284 285<pre class="text"> 286MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images, 287 const char *filename,ExceptionInfo *exception) 288</pre> 289 290<p>A description of each parameter follows:</p> 291 292<dd> 293</dd> 294 295<dd> </dd> 296<dl class="dl-horizontal"> 297<dt>image_info</dt> 298<dd>the image info. </dd> 299 300<dd> </dd> 301<dt>images</dt> 302<dd>the image list. </dd> 303 304<dd> </dd> 305<dt>filename</dt> 306<dd>the image filename. </dd> 307 308<dd> </dd> 309<dt>exception</dt> 310<dd>return any errors or warnings in this structure. </dd> 311 312<dd> </dd> 313</dl> 314</div> 315 </div> 316 </main><!-- /.container --> 317 <footer class="magick-footer"> 318 <p><a href="../../www/security-policy.html">Security</a> • 319 <a href="../../www/architecture.html">Architecture</a> • 320 <a href="../../www/links.html">Related</a> • 321 <a href="../../www/sitemap.html">Sitemap</a> 322 323 <a href="constitute.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../images/wand.ico"/></a> 324 325 <a href="http://pgp.mit.edu/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • 326 <a href="../../www/support.html">Donate</a> • 327 <a href="../../www/contact.html">Contact Us</a> 328 <br/> 329 <small>© 1999-2019 ImageMagick Studio LLC</small></p> 330 </footer> 331 332 <!-- Javascript assets --> 333 <script src="../assets/magick.js" crossorigin="anonymous"></script> 334 <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.3.1/jquery.min.js"><\/script>')</script> 335</body> 336</html> 337<!-- Magick Cache 29th December 2018 16:30 -->