Home | History | Annotate | Download | only in api
      1 
      2 
      3 
      4 
      5 <!DOCTYPE html>
      6 <html lang="en">
      7 <head>
      8     <title>ImageMagick: MagickCore, C API for ImageMagick: Constitute an Image</title>
      9   <meta charset="utf-8" />
     10   <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     11   <meta name="viewport" content="width=device-width, initial-scale=1" />
     12   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     13   <meta name="application-name" content="ImageMagick"/>
     14   <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 Bzier curves."/>
     15   <meta name="application-url" content="http://www.imagemagick.org"/>
     16   <meta name="generator" content="PHP"/>
     17   <meta name="keywords" content="magickcore, c, api, for, imagemagick:, constitute, an, image, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/>
     18   <meta name="rating" content="GENERAL"/>
     19   <meta name="robots" content="INDEX, FOLLOW"/>
     20   <meta name="generator" content="ImageMagick Studio LLC"/>
     21   <meta name="author" content="ImageMagick Studio LLC"/>
     22   <meta name="revisit-after" content="2 DAYS"/>
     23   <meta name="resource-type" content="document"/>
     24   <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/>
     25   <meta name="distribution" content="Global"/>
     26   <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
     27   <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
     28   <link rel="icon" href="../images/wand.png"/>
     29   <link rel="shortcut icon" href="../images/wand.ico"/>
     30   <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:900,400,400italic,700,700italic,300,300italic|Open+Sans:300italic,400italic,700italic,300,400,600,700">
     31   <link rel="stylesheet" href="../css/magick.html"/>
     32 </head>
     33 <body>
     34 <div class="main">
     35 <div class="magick-masthead">
     36   <div class="container">
     37     <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
     38          style="display:block"
     39          data-ad-client="ca-pub-3129977114552745"
     40          data-ad-slot="6345125851"
     41          data-ad-format="auto"></ins>
     42     <script>
     43       (adsbygoogle = window.adsbygoogle || []).push({});
     44     </script>
     45     <nav class="magick-nav">
     46       <a class="magick-nav-item " href="../index.html">Home</a>
     47       <a class="magick-nav-item " href="../binary-releases.html">Download</a>
     48       <a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
     49       <a class="magick-nav-item " href="../command-line-processing.html">Command-line</a>
     50       <a class="magick-nav-item " href="../resources.html">Resources</a>
     51       <a class="magick-nav-item " href="api.html">Develop</a>
     52       <a class="magick-nav-item " href="http://www.imagemagick.org/script/search.php">Search</a>
     53       <a class="magick-nav-item pull-right" href="https://www.imagemagick.org/discourse-server/">Community</a>
     54     </nav>
     55   </div>
     56 </div>
     57 <div class="container">
     58 <div class="magick-header">
     59 <p class="text-center"><a href="constitute.html#ConstituteImage">ConstituteImage</a> &#8226; <a href="constitute.html#PingImage">PingImage</a> &#8226; <a href="constitute.html#PingImages">PingImages</a> &#8226; <a href="constitute.html#ReadImage">ReadImage</a> &#8226; <a href="constitute.html#ReadImages">ReadImages</a> &#8226; <a href="constitute.html#WriteImage">WriteImage</a> &#8226; <a href="constitute.html#WriteImages">WriteImages</a></p>
     60 
     61 <h2><a href="http://www.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">
     66 image = 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">
     72 Image *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://www.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">
    116 Image *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://www.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">
    142 Image *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://www.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">
    173 Image *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://www.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">
    199 Image *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://www.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">
    230 MagickBooleanType 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://www.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">
    261 MagickBooleanType 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>
    289 </div>
    290   <footer class="magick-footer">
    291     <p><a href="../support.html">Donate</a> 
    292      <a href="../sitemap.html">Sitemap</a> 
    293     <a href="../links.html">Related</a> 
    294     <a href="../architecture.html">Architecture</a>
    295 </p>
    296     <p><a href="constitute.html#">Back to top</a> 
    297     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 
    298     <a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p>
    299         <p><small>  1999-2016 ImageMagick Studio LLC</small></p>
    300   </footer>
    301 </div><!-- /.container -->
    302 
    303   <script src="https://localhost/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    304   <script src="../js/magick.html"></script>
    305 </div>
    306 </body>
    307 </html>
    308