Home | History | Annotate | Download | only in api
      1 
      2 
      3 
      4 
      5 <!DOCTYPE html>
      6 <html lang="en">
      7 <head>
      8   <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
      9     <title>ImageMagick: MagickCore, C API for ImageMagick: Constitute an Image</title>
     10   <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
     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 Bzier 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"/>
     22   <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/>
     23   <meta name="distribution" content="Global"/>
     24   <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/>
     25   <link rel="icon" href="../image/wand.png"/>
     26   <link rel="shortcut icon" href="../image/wand.ico"/>
     27   <link rel="stylesheet" href="../css/magick.php"/>
     28 </head>
     29 <body>
     30 <div class="main">
     31 <div class="magick-masthead">
     32   <div class="container">
     33     <script async="async" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
     34          style="display:block"
     35          data-ad-client="ca-pub-3129977114552745"
     36          data-ad-slot="6345125851"
     37          data-ad-format="auto"></ins>
     38     <script>
     39       (adsbygoogle = window.adsbygoogle || []).push({});
     40     </script>
     41     <nav class="magick-nav">
     42       <a class="magick-nav-item " href="../index.php">Home</a>
     43       <a class="magick-nav-item " href="../script/binary-releases.php">Download</a>
     44       <a class="magick-nav-item " href="../script/command-line-tools.php">Tools</a>
     45       <a class="magick-nav-item " href="../script/command-line-options.php">Options</a>
     46       <a class="magick-nav-item " href="../script/resources.php">Resources</a>
     47       <a class="magick-nav-item " href="../script/api.php">Develop</a>
     48       <a class="magick-nav-item " href="../script/search.php">Search</a>
     49       <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
     50     </nav>
     51   </div>
     52 </div>
     53 <div class="container">
     54 <div class="magick-header">
     55 <p class="text-center"><a href="constitute.php#ConstituteImage">ConstituteImage</a> &bull; <a href="constitute.php#PingImage">PingImage</a> &bull; <a href="constitute.php#PingImages">PingImages</a> &bull; <a href="constitute.php#ReadImage">ReadImage</a> &bull; <a href="constitute.php#ReadImages">ReadImages</a> &bull; <a href="constitute.php#WriteImage">WriteImage</a> &bull; <a href="constitute.php#WriteImages">WriteImages</a></p>
     56 
     57 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="ConstituteImage">ConstituteImage</a></h2>
     58 
     59 <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>
     60 
     61 <pre class="text">
     62 image = ConstituteImage(640,480,"RGB",CharPixel,pixels,&amp;exception);
     63 </pre>
     64 
     65 <p>The format of the ConstituteImage method is:</p>
     66 
     67 <pre class="text">
     68 Image *ConstituteImage(const size_t columns,const size_t rows,
     69   const char *map,const StorageType storage,const void *pixels,
     70   ExceptionInfo *exception)
     71 </pre>
     72 
     73 <p>A description of each parameter follows:</p>
     74 
     75 <dd>
     76 </dd>
     77 
     78 <dd> </dd>
     79 <dl class="dl-horizontal">
     80 <dt>columns</dt>
     81 <dd>width in pixels of the image. </dd>
     82 
     83 <dd> </dd>
     84 <dt>rows</dt>
     85 <dd>height in pixels of the image. </dd>
     86 
     87 <dd> </dd>
     88 <dt>map</dt>
     89 <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>
     90 
     91 <dd> </dd>
     92 <dt>storage</dt>
     93 <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>
     94 
     95 <dd> </dd>
     96 <dt>pixels</dt>
     97 <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>
     98 
     99 <dd> </dd>
    100 <dt>exception</dt>
    101 <dd>return any errors or warnings in this structure. </dd>
    102 
    103 <dd>  </dd>
    104 </dl>
    105 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="PingImage">PingImage</a></h2>
    106 
    107 <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>
    108 
    109 <p>The format of the PingImage method is:</p>
    110 
    111 <pre class="text">
    112 Image *PingImage(const ImageInfo *image_info,ExceptionInfo *exception)
    113 </pre>
    114 
    115 <p>A description of each parameter follows:</p>
    116 
    117 <dd>
    118 </dd>
    119 
    120 <dd> </dd>
    121 <dl class="dl-horizontal">
    122 <dt>image_info</dt>
    123 <dd>Ping the image defined by the file or filename members of this structure. </dd>
    124 
    125 <dd> </dd>
    126 <dt>exception</dt>
    127 <dd>return any errors or warnings in this structure. </dd>
    128 
    129 <dd>  </dd>
    130 </dl>
    131 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="PingImages">PingImages</a></h2>
    132 
    133 <p>PingImages() pings one or more images and returns them as an image list.</p>
    134 
    135 <p>The format of the PingImage method is:</p>
    136 
    137 <pre class="text">
    138 Image *PingImages(ImageInfo *image_info,const char *filename,
    139   ExceptionInfo *exception)
    140 </pre>
    141 
    142 <p>A description of each parameter follows:</p>
    143 
    144 <dd>
    145 </dd>
    146 
    147 <dd> </dd>
    148 <dl class="dl-horizontal">
    149 <dt>image_info</dt>
    150 <dd>the image info. </dd>
    151 
    152 <dd> </dd>
    153 <dt>filename</dt>
    154 <dd>the image filename. </dd>
    155 
    156 <dd> </dd>
    157 <dt>exception</dt>
    158 <dd>return any errors or warnings in this structure. </dd>
    159 
    160 <dd>  </dd>
    161 </dl>
    162 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="ReadImage">ReadImage</a></h2>
    163 
    164 <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>
    165 
    166 <p>The format of the ReadImage method is:</p>
    167 
    168 <pre class="text">
    169 Image *ReadImage(const ImageInfo *image_info,ExceptionInfo *exception)
    170 </pre>
    171 
    172 <p>A description of each parameter follows:</p>
    173 
    174 <dd>
    175 </dd>
    176 
    177 <dd> </dd>
    178 <dl class="dl-horizontal">
    179 <dt>image_info</dt>
    180 <dd>Read the image defined by the file or filename members of this structure. </dd>
    181 
    182 <dd> </dd>
    183 <dt>exception</dt>
    184 <dd>return any errors or warnings in this structure. </dd>
    185 
    186 <dd>  </dd>
    187 </dl>
    188 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="ReadImages">ReadImages</a></h2>
    189 
    190 <p>ReadImages() reads one or more images and returns them as an image list.</p>
    191 
    192 <p>The format of the ReadImage method is:</p>
    193 
    194 <pre class="text">
    195 Image *ReadImages(ImageInfo *image_info,const char *filename,
    196   ExceptionInfo *exception)
    197 </pre>
    198 
    199 <p>A description of each parameter follows:</p>
    200 
    201 <dd>
    202 </dd>
    203 
    204 <dd> </dd>
    205 <dl class="dl-horizontal">
    206 <dt>image_info</dt>
    207 <dd>the image info. </dd>
    208 
    209 <dd> </dd>
    210 <dt>filename</dt>
    211 <dd>the image filename. </dd>
    212 
    213 <dd> </dd>
    214 <dt>exception</dt>
    215 <dd>return any errors or warnings in this structure. </dd>
    216 
    217 <dd>  </dd>
    218 </dl>
    219 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="WriteImage">WriteImage</a></h2>
    220 
    221 <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>
    222 
    223 <p>The format of the WriteImage method is:</p>
    224 
    225 <pre class="text">
    226 MagickBooleanType WriteImage(const ImageInfo *image_info,Image *image,
    227   ExceptionInfo *exception)
    228 </pre>
    229 
    230 <p>A description of each parameter follows:</p>
    231 
    232 <dd>
    233 </dd>
    234 
    235 <dd> </dd>
    236 <dl class="dl-horizontal">
    237 <dt>image_info</dt>
    238 <dd>the image info. </dd>
    239 
    240 <dd> </dd>
    241 <dt>image</dt>
    242 <dd>the image. </dd>
    243 
    244 <dd> </dd>
    245 <dt>exception</dt>
    246 <dd>return any errors or warnings in this structure. </dd>
    247 
    248 <dd>  </dd>
    249 </dl>
    250 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/constitute_8c.html" id="WriteImages">WriteImages</a></h2>
    251 
    252 <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>
    253 
    254 <p>The format of the WriteImages method is:</p>
    255 
    256 <pre class="text">
    257 MagickBooleanType WriteImages(const ImageInfo *image_info,Image *images,
    258   const char *filename,ExceptionInfo *exception)
    259 </pre>
    260 
    261 <p>A description of each parameter follows:</p>
    262 
    263 <dd>
    264 </dd>
    265 
    266 <dd> </dd>
    267 <dl class="dl-horizontal">
    268 <dt>image_info</dt>
    269 <dd>the image info. </dd>
    270 
    271 <dd> </dd>
    272 <dt>images</dt>
    273 <dd>the image list. </dd>
    274 
    275 <dd> </dd>
    276 <dt>filename</dt>
    277 <dd>the image filename. </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 </div>
    286   <footer class="magick-footer">
    287     <p><a href="../script/support.php">Donate</a> 
    288      <a href="../script/sitemap.php">Sitemap</a> 
    289     <a href="../script/links.php">Related</a> 
    290     <a href="../script/architecture.php">Architecture</a>
    291 </p>
    292     <p><a href="constitute.php#">Back to top</a> 
    293     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 
    294     <a href="../script/contact.php">Contact Us</a></p>
    295         <p><small>  1999-2016 ImageMagick Studio LLC</small></p>
    296   </footer>
    297 </div><!-- /.container -->
    298 
    299   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    300   <script src="http://nextgen.imagemagick.org/js/magick.php"></script>
    301 </div>
    302 </body>
    303 </html>
    304