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