Home | History | Annotate | Download | only in www
      1 
      2 
      3 
      4 
      5 <!DOCTYPE html>
      6 <html lang="en">
      7 <head>
      8     <title>ImageMagick: Magick++, C++ API for ImageMagick</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="magick++, c++, api, for, imagemagick, 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.css"/>
     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="magick++.html#documentation">Documentation</a>  <a href="magick++.html#get">Obtaining Magick++</a>  <a href="magick++.html#install">Installation</a>  <a href="magick++.html#bugs">Reporting Bugs</a></p>
     60 
     61 <a id="intro"></a>
     62 <p class="lead magick-description"><a href="api/Magick++/index.html">Magick++ API</a> is the object-oriented C++ API to the <a href="../index.html">ImageMagick</a> image-processing library.</p>
     63 <p>Magick++ supports an object model which is inspired by <a href="perl-magick.html">PerlMagick</a>.
     64 Images support implicit reference counting so that copy constructors
     65 and assignment incur almost no cost. The cost of actually copying an
     66 image (if necessary) is done just before modification and this copy
     67 is managed automagically by Magick++. De-referenced copies are
     68 automagically deleted. The image objects support value (rather than
     69 pointer) semantics so it is trivial to support multiple generations
     70 of an image in memory at one time. 
     71 </p>
     72 <p>Magick++ provides integrated support for the <a href="http://www.sgi.com/tech/stl/">Standard
     73 Template Library</a> (STL) so that the powerful containers available
     74 (e.g. <a href="http://www.sgi.com/tech/stl/Deque.html">deque</a>,
     75 <a href="http://www.sgi.com/tech/stl/Vector.html">vector</a>, <a href="http://www.sgi.com/tech/stl/List.html">list</a>,
     76 and <a href="http://www.sgi.com/tech/stl/Map.html">map</a>)  can
     77 be used to write programs similar to those possible with PERL &amp;
     78 PerlMagick. STL-compatible template versions of ImageMagick's
     79 list-style operations are provided so that operations may be
     80 performed on multiple images stored in STL containers. 
     81 </p>
     82 <h2 class="magick-header">Documentation</h2>
     83 <a id="documentation"></a>
     84 <p>Detailed <a href="api/magick++-classes.html">documentation</a> is
     85 provided for all Magick++ classes, class methods, and template
     86 functions which comprise the API.  See a <a href="../Magick++/tutorial/Magick++_tutorial.pdf">  Gentle Introduction to Magick++</a> for an introductory tutorial to Magick++.  We include the <a href="../Magick++/tutorial/Magick++_tutorial.odt" >source</a> if you want to correct, enhance, or expand the tutorial.</p>
     87 <h2 class="magick-header">Obtaining Magick++</h2>
     88 <a id="get"></a>
     89 <p>Magick++ is included as part of <a href="../index.html">ImageMagick</a>
     90 source releases and may be retrieved via <a href="download.html">ftp</a>
     91 or <a href="http://git.imagemagick.org/repos/ImageMagick/Magick++">GIT</a>.
     92 </p>
     93 <h2 class="magick-header">Installation</h2>
     94 <a id="install"></a>
     95 <p>Once you have the Magick++ sources available, follow these detailed
     96 <a href="../Magick++/Install.html">installation instructions</a> for UNIX and
     97 Windows. 
     98 </p>
     99 <h2 class="magick-header">Usage</h2>
    100 <p>A helper script named <code>Magick++-config</code> is installed
    101 under Unix which assists with recalling compilation options required
    102 to compile and link programs which use Magick++. For example, the
    103 following command compiles and links the source file <code>demo.cpp</code>
    104 to produce the executable <code>demo</code> (notice that quotes are
    105 backward quotes): 
    106 </p>
    107 <pre>
    108 c++ `Magick++-config --cxxflags --cppflags` -O2 -o demo demo.cpp \
    109   `Magick++-config --ldflags --libs`
    110 </pre>
    111 <p>Set the <code>PKG_CONFIG_PATH</code> environment variable if ImageMagick is not in your default system path:</p>
    112 
    113 <pre>
    114 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
    115 </pre>
    116 
    117 <p>Windows users may get started by manually editing a project file
    118 for one of the Magick++ demo programs. 
    119 </p>
    120 <p>Note, under Windows (and possibly the Mac) it may be necessary to initialize the ImageMagick library prior to using the Magick++ library. This initialization is performed by passing the path to the ImageMagick DLLs (assumed to be in the same directory as your program) to the InitializeMagick() function call. This is commonly performed by providing the path to your program (argv[0]) as shown in the following example: </p>
    121 <pre>
    122 int main( int argc, char ** argv) {
    123   InitializeMagick(*argv);
    124   ...
    125 </pre>
    126 <p>This initialization step is not required under Unix, Linux,
    127 Cygwin, or any other operating environment that supports the notion
    128 of <var>installing</var> ImageMagick in a known location.  </p>
    129 <p>Here is a example program that utilizes the Magick++ API to get you started, <a href="../source/magick++.cpp">magick++.cpp</a>. It reads an image, crops it, and writes it to disk in the PNG image format.</p>
    130 
    131 <pre class="pre-scrollable">
    132 #include &lt;Magick++.h> 
    133 #include &lt;iostream> 
    134 
    135 using namespace std; 
    136 using namespace Magick; 
    137 
    138 int main(int argc,char **argv) 
    139 { 
    140   InitializeMagick(*argv);
    141 
    142   // Construct the image object. Seperating image construction from the 
    143   // the read operation ensures that a failure to read the image file 
    144   // doesn't render the image object useless. 
    145   Image image;
    146   try { 
    147     // Read a file into image object 
    148     image.read( "logo:" );
    149 
    150     // Crop the image to specified size (width, height, xOffset, yOffset)
    151     image.crop( Geometry(100,100, 100, 100) );
    152 
    153     // Write the image to a file 
    154     image.write( "logo.png" ); 
    155   } 
    156   catch( Exception &amp;error_ ) 
    157     { 
    158       cout &lt;&lt; "Caught exception: " &lt;&lt; error_.what() &lt;&lt; endl; 
    159       return 1; 
    160     } 
    161   return 0; 
    162 }
    163 </pre>
    164 <h2 class="magick-header">Reporting Bugs</h2>
    165 <a id="bugs"></a>
    166 <p>Questions regarding usage should be directed to or to report any bugs go to
    167 <a href="http://www.imagemagick.org/discourse-server/viewforum.html?f=23">Magick++ bug tracking forum</a>.
    168 </p>
    169 </div>
    170   <footer class="magick-footer">
    171     <p><a href="support.html">Donate</a> 
    172      <a href="sitemap.html">Sitemap</a> 
    173     <a href="links.html">Related</a> 
    174     <a href="architecture.html">Architecture</a>
    175 </p>
    176     <p><a href="magick++.html#">Back to top</a> 
    177     <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 
    178     <a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p>
    179         <p><small>  1999-2016 ImageMagick Studio LLC</small></p>
    180   </footer>
    181 </div><!-- /.container -->
    182 
    183   <script src="https://localhost/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    184   <script src="../js/magick.html"></script>
    185 </div>
    186 </body>
    187 </html>
    188