<?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="Docutils 0.8: http://docutils.sourceforge.net/" /> <title>Magick++ API for GraphicsMagick</title> <link rel="stylesheet" href="../docutils-articles.css" type="text/css" /> </head> <body> <div class="banner"> <img src="../images/gm-107x76.png" alt="GraphicMagick logo" width="107" height="76" /> <span class="title">GraphicsMagick</span> <form action="http://www.google.com/search"> <input type="hidden" name="domains" value="www.graphicsmagick.org" /> <input type="hidden" name="sitesearch" value="www.graphicsmagick.org" /> <span class="nowrap"><input type="text" name="q" size="25" maxlength="255" /> <input type="submit" name="sa" value="Search" /></span> </form> </div> <div class="navmenu"> <ul> <li><a href="../index.html">Home</a></li> <li><a href="../project.html">Project</a></li> <li><a href="../download.html">Download</a></li> <li><a href="../README.html">Install</a></li> <li><a href="../Hg.html">Source</a></li> <li><a href="../NEWS.html">News</a> </li> <li><a href="https://sourceforge.net/tracker/?group_id=73485" target="top_">Bugs</a></li> <li><a href="../utilities.html">Utilities</a></li> <li><a href="../programming.html">Programming</a></li> <li><a href="../reference.html">Reference</a></li> </ul> </div> <div class="document" id="magick-api-for-graphicsmagick"> <h1 class="title">Magick++ API for GraphicsMagick</h1> <div class="section" id="introduction"> <h1>Introduction</h1> <p><em>Magick++</em> is the object-oriented C++ API to the <a class="reference external" href="../index.html">GraphicsMagick</a> image-processing library, the most comprehensive open-source image processing package available. Read the <a class="reference external" href="ChangeLog.html">ChangeLog</a> for <em>Magick++</em>.</p> <p><em>Magick++</em> supports an object model which is inspired by <a class="reference external" href="../perl.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 automatically by <em>Magick++</em>. De-referenced copies are automatically 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><em>Magick++</em> provides integrated support for the <a class="reference external" href="http://www.sgi.com/tech/stl/">Standard Template Library</a> (<a class="reference external" href="http://www.sgi.com/tech/stl/">STL</a>) so that the powerful containers available (e.g. <a class="reference external" href="http://www.sgi.com/tech/stl/Deque.html">deque</a>, <a class="reference external" href="http://www.sgi.com/tech/stl/Vector.html">vector</a>, <a class="reference external" href="http://www.sgi.com/tech/stl/List.html">list</a>, and <a class="reference external" href="http://www.sgi.com/tech/stl/Map.html">map</a>) can be used to write programs similar to those possible with PERL & <a class="reference external" href="../perl.html">PerlMagick</a>. STL-compatible template versions of GraphicsMagick's list-style operations are provided so that operations may be performed on multiple images stored in STL containers.</p> </div> <div class="section" id="id1"> <h1>Documentation</h1> <p>Detailed <a class="reference external" href="Documentation.html">documentation</a> are provided for all <em>Magick++</em> classes, class methods, and template functions which comprise the API.</p> </div> <div class="section" id="obtaining-magick"> <h1>Obtaining Magick++</h1> <p><em>Magick++</em> is included as part of <a class="reference external" href="../index.html">GraphicsMagick</a> source releases and may be retrieved via <a class="reference external" href="../download.html">ftp</a> or <a class="reference external" href="../CVS.html">CVS</a>.</p> </div> <div class="section" id="installation"> <h1>Installation</h1> <p>Installation is very easy since <em>Magick++</em> is part of <a class="reference external" href="../index.html">GraphicsMagick</a> and is built by default. Once <a class="reference external" href="../index.html">GraphicsMagick</a> is built, then <em>Magick++</em> is available for use.</p> </div> <div class="section" id="usage"> <h1>Usage</h1> <p>A helper script named <em>GraphicsMagick++-config</em> is installed in the same directory as the GraphicsMagick <em>gm</em> program under Unix which assists with recalling compilation options required to compile and link programs which depend on <em>Magick++</em>. For example, the following command will compile and link the source file example.cpp to produce the executable example (notice that quotes are backward quotes):</p> <pre class="literal-block"> c++ -o example example.cpp `GraphicsMagick++-config --cppflags --cxxflags --ldflags --libs` </pre> <p>Windows users may get started by manually editing a project file for one of the <em>Magick++</em> demo programs.</p> <p>It is necessary to initialize the GraphicsMagick library prior to using the <em>Magick++</em> library. This initialization is performed by passing the path to the GraphicsMagick 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 class="literal-block"> int main( int /*argc*/, char ** argv) { InitializeMagick(*argv); </pre> <p>If you don't have the path to your executable, then pass NULL and usually the library will be found anyway. Besides helping to find the GraphicsMagick DLL/library and configuration files, InitializeMagick() initializes all of the semaphores and data necessary for a multi-threaded program to be completely thread safe. This step used to be optional, but it is now absolutely required. Failure to initialize GraphicsMagick will result in an application crash.</p> </div> <div class="section" id="reporting-bugs"> <h1>Reporting Bugs</h1> <p>Please report any bugs via the <a class="reference external" href="http://sourceforge.net/projects/graphicsmagick/">GraphicsMagick Bug Tracker</a>. Questions regarding usage should be directed to <a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">Bob Friesenhahn</a>.</p> <p>Copyright © Bob Friesenhahn 1999 - 2010</p> </div> </div> </body> </html>