| |
| |
| |
| |
| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8" /> |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> |
| <meta http-equiv="x-ua-compatible" content="ie=edge" /> |
| <title>Magick++, C++ API @ ImageMagick</title> |
| <meta http-equiv="content-type" content="text/html; charset=utf-8"/> |
| <meta name="application-name" content="ImageMagick"/> |
| <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 Bézier curves."/> |
| <meta name="application-url" content="https://www.imagemagick.org"/> |
| <meta name="generator" content="PHP"/> |
| <meta name="keywords" content="magick++, c++, api, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert"/> |
| <meta name="rating" content="GENERAL"/> |
| <meta name="robots" content="INDEX, FOLLOW"/> |
| <meta name="generator" content="ImageMagick Studio LLC"/> |
| <meta name="author" content="ImageMagick Studio LLC"/> |
| <meta name="revisit-after" content="2 DAYS"/> |
| <meta name="resource-type" content="document"/> |
| <meta name="copyright" content="Copyright (c) 1999-2016 ImageMagick Studio LLC"/> |
| <meta name="distribution" content="Global"/> |
| <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/> |
| <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> |
| <link rel="canonical" href="https://www.imagemagick.org/script/magick++.html"/> |
| <link rel="icon" href="../images/wand.png"/> |
| <link rel="shortcut icon" href="../images/wand.ico"/> |
| <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" /> |
| <link rel="stylesheet" href="css/magick.css"/> |
| </head> |
| <body> |
| <div class="main"> |
| <div class="magick-masthead"> |
| <div class="container"> |
| <script async="async" src="http://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" |
| style="display:block" |
| data-ad-client="ca-pub-3129977114552745" |
| data-ad-slot="6345125851" |
| data-ad-format="auto"></ins> |
| <script> |
| (adsbygoogle = window.adsbygoogle || []).push({}); |
| </script> |
| <nav class="magick-nav"> |
| <a class="magick-nav-item " href="../index.html">Home</a> |
| <a class="magick-nav-item " href="binary-releases.html">Download</a> |
| <a class="magick-nav-item " href="command-line-tools.html">Tools</a> |
| <a class="magick-nav-item " href="command-line-processing.html">Command-line</a> |
| <a class="magick-nav-item " href="resources.html">Resources</a> |
| <a class="magick-nav-item " href="api.html">Develop</a> |
| <a class="magick-nav-item " href="https://www.imagemagick.org/script/search.php">Search</a> |
| <a class="magick-nav-item pull-right" href="https://www.imagemagick.org/discourse-server/">Community</a> |
| </nav> |
| </div> |
| </div> |
| <div class="container"> |
| <div class="magick-header"> |
| <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> |
| |
| <a id="intro"></a> |
| <p class="lead magick-description"><a href="http://www.imagemagick.org/api/Magick++/index.html">Magick++ API</a> is the object-oriented C++ API to the <a href="https://www.imagemagick.org/">ImageMagick</a> image-processing library.</p> |
| <p>Magick++ supports an object model which is inspired by <a href="https://www.imagemagick.org/script/perl-magick.html">PerlMagick</a>. |
| Images support implicit reference counting so that copy constructors |
| and assignment incur almost no cost. The cost of actually copying an |
| image (if necessary) is done just before modification and this copy |
| is managed automagically by Magick++. De-referenced copies are |
| automagically deleted. The image objects support value (rather than |
| pointer) semantics so it is trivial to support multiple generations |
| of an image in memory at one time. |
| </p> |
| <p>Magick++ provides integrated support for the <a href="http://www.sgi.com/tech/stl/">Standard |
| Template Library</a> (STL) so that the powerful containers available |
| (e.g. <a href="http://www.sgi.com/tech/stl/Deque.html">deque</a>, |
| <a href="http://www.sgi.com/tech/stl/Vector.html">vector</a>, <a href="http://www.sgi.com/tech/stl/List.html">list</a>, |
| and <a href="http://www.sgi.com/tech/stl/Map.html">map</a>) can |
| be used to write programs similar to those possible with PERL & |
| PerlMagick. STL-compatible template versions of ImageMagick's |
| list-style operations are provided so that operations may be |
| performed on multiple images stored in STL containers. |
| </p> |
| <h2 class="magick-header">Documentation</h2> |
| <a id="documentation"></a> |
| <p>Detailed <a href="http://www.imagemagick.org/api/magick++-classes.html">documentation</a> is |
| provided for all Magick++ classes, class methods, and template |
| functions which comprise the API. See a <a href="https://www.imagemagick.org/Magick++/tutorial/Magick++_tutorial.pdf"> Gentle Introduction to Magick++</a> for an introductory tutorial to Magick++. We include the <a href="https://www.imagemagick.org/Magick++/tutorial/Magick++_tutorial.odt" >source</a> if you want to correct, enhance, or expand the tutorial.</p> |
| <h2 class="magick-header">Obtaining Magick++</h2> |
| <a id="get"></a> |
| <p>Magick++ is included as part of <a href="../index.html">ImageMagick</a> |
| source releases and may be retrieved via <a href="https://www.imagemagick.org/script/download.html">ftp</a> |
| or <a href="http://git.imagemagick.org/repos/ImageMagick/Magick++">GIT</a>. |
| </p> |
| <h2 class="magick-header">Installation</h2> |
| <a id="install"></a> |
| <p>Once you have the Magick++ sources available, follow these detailed |
| <a href="../Magick++/Install.html">installation instructions</a> for UNIX and |
| Windows. |
| </p> |
| <h2 class="magick-header">Usage</h2> |
| <p>A helper script named <code>Magick++-config</code> is installed |
| under Unix which assists with recalling compilation options required |
| to compile and link programs which use Magick++. For example, the |
| following command compiles and links the source file <code>demo.cpp</code> |
| to produce the executable <code>demo</code> (notice that quotes are |
| backward quotes): |
| </p> |
| <pre> |
| c++ `Magick++-config --cxxflags --cppflags` -O2 -o demo demo.cpp \ |
| `Magick++-config --ldflags --libs` |
| </pre> |
| <p>Set the <code>PKG_CONFIG_PATH</code> environment variable if ImageMagick is not in your default system path:</p> |
| |
| <pre> |
| export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig |
| </pre> |
| |
| <p>Windows users may get started by manually editing a project file |
| for one of the Magick++ demo programs. |
| </p> |
| <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> |
| <pre> |
| int main( int argc, char ** argv) { |
| InitializeMagick(*argv); |
| ... |
| </pre> |
| <p>This initialization step is not required under Unix, Linux, |
| Cygwin, or any other operating environment that supports the notion |
| of <var>installing</var> ImageMagick in a known location. </p> |
| <p>Here is a example program that utilizes the Magick++ API to get you started, <a href="http://www.imagemagick.org/source/magick++.cpp">magick++.cpp</a>. It reads an image, crops it, and writes it to disk in the PNG image format.</p> |
| |
| <pre class="pre-scrollable"> |
| #include <Magick++.h> |
| #include <iostream> |
| |
| using namespace std; |
| using namespace Magick; |
| |
| int main(int argc,char **argv) |
| { |
| InitializeMagick(*argv); |
| |
| // Construct the image object. Seperating image construction from the |
| // the read operation ensures that a failure to read the image file |
| // doesn't render the image object useless. |
| Image image; |
| try { |
| // Read a file into image object |
| image.read( "logo:" ); |
| |
| // Crop the image to specified size (width, height, xOffset, yOffset) |
| image.crop( Geometry(100,100, 100, 100) ); |
| |
| // Write the image to a file |
| image.write( "logo.png" ); |
| } |
| catch( Exception &error_ ) |
| { |
| cout << "Caught exception: " << error_.what() << endl; |
| return 1; |
| } |
| return 0; |
| } |
| </pre> |
| <h2 class="magick-header">Reporting Bugs</h2> |
| <a id="bugs"></a> |
| <p>Questions regarding usage should be directed to or to report any bugs go to |
| <a href="https://www.imagemagick.org/discourse-server/viewforum.html?f=23">Magick++ bug tracking forum</a>. |
| </p> |
| </div> |
| <footer class="magick-footer"> |
| <p><a href="support.html">Donate</a> • |
| <a href="sitemap.html">Sitemap</a> • |
| <a href="links.html">Related</a> • |
| <a href="security-policy.html">Security</a> • |
| <a href="architecture.html">Architecture</a> |
| </p> |
| <p><a href="magick++.html#">Back to top</a> • |
| <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • |
| <a href="https://www.imagemagick.org/script/contact.php">Contact Us</a></p> |
| <p><small>© 1999-2016 ImageMagick Studio LLC</small></p> |
| </footer> |
| </div><!-- /.container --> |
| |
| <script src="https://localhost/ajax/libs/jquery/1.11.3/jquery.min.js"></script> |
| <script src="../js/magick.html"></script> |
| </div> |
| </body> |
| </html> |
| <!-- Magick Cache 22nd November 2016 09:38 --> |