Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates > by-pkgid > d5eeaf790b79cccb8c13fbdcd72c23b5 > files > 189

graphicsmagick-doc-1.3.33-1.1.mga7.noarch.rpm

<?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.13.1: http://docutils.sourceforge.net/" />
<title>GraphicsMagick Wand C API</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" />&nbsp;<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="../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="graphicsmagick-wand-c-api">
<h1 class="title">GraphicsMagick Wand C API</h1>

<!-- -*- mode: rst -*- -->
<!-- This text is in reStucturedText format, so it may look a bit odd. -->
<!-- See http://docutils.sourceforge.net/rst.html for details. -->
<p>The GraphicsMagick Wand C library provides a mid-level abstract C
language programming interface for GraphicsMagick.  It is originally
based on the Wand API provided in ImageMagick as of August 2003.
After August 2003, ImageMagick changed its license to one unusable by
GraphicsMagick so this version of the Wand library is not completely
in sync with the current ImageMagick version.</p>
<p>The API is divided into a number of categories. While reading this
documentation, please reference the <a class="reference external" href="../api/types.html">types</a> documentation as required:</p>
<blockquote>
<ul class="simple">
<li><a class="reference external" href="drawing_wand.html">Drawing</a>: Wand vector drawing interfaces.</li>
<li><a class="reference external" href="magick_wand.html">Magick</a>: Wand image processing interfaces</li>
<li><a class="reference external" href="pixel_wand.html">Pixel</a>: Wand pixel access/update interfaces</li>
</ul>
</blockquote>
<p>The following is a simple example program which (assuming the program
name is <cite>rotate</cite>) is executed similar to <cite>rotate infile outfile</cite>.  It
reads from file <cite>infile</cite>, rotates the image 30 degrees using a black
background, and writes the result to file <cite>outfile</cite>:</p>
<pre class="literal-block">
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;wand/magick_wand.h&gt;

int main(int argc,char **argv)
{
  MagickWand *magick_wand;
  MagickPassFail status = MagickPass;
  const char *infile, *outfile;

  if (argc != 3)
    {
      fprintf(stderr,&quot;Usage: %s: infile outfile\n&quot;,argv[0]);
      return 1;
    }

  infile=argv[1];
  outfile=argv[2];

  // Initialize GraphicsMagick API
  InitializeMagick(*argv);

  // Allocate Wand handle
  magick_wand=NewMagickWand();

  // Read input image file
  if (status == MagickPass)
    {
      status = MagickReadImage(magick_wand,infile);
    }

  // Rotate image clockwise 30 degrees with black background
  if (status == MagickPass)
    {
      PixelWand *background;
      background=NewPixelWand();
      PixelSetColor(background,&quot;#000000&quot;);
      status = MagickRotateImage(magick_wand,background,30);
      DestroyPixelWand(background);
    }

  // Write output file
  if (status == MagickPass)
    {
      status = MagickWriteImage(magick_wand,outfile);
    }

  // Diagnose any error
  if (status != MagickPass)
    {
      char *description;
      ExceptionType severity;

      description=MagickGetException(magick_wand,&amp;severity);
      (void) fprintf(stderr,&quot;%.1024s (severity %d)\n&quot;,
                     description,severity);
    }

  // Release Wand handle
  DestroyMagickWand(magick_wand);

  // Destroy GraphicsMagick API
  DestroyMagick();

  return (status == MagickPass ? 0 : 1);
}
</pre>
<p>To compile on Unix, the command looks something like this:</p>
<pre class="literal-block">
gcc -o demo demo.c -O `GraphicsMagickWand-config --cppflags --ldflags --libs`
</pre>
<p>The GraphicsMagickWand-config script reproduces the options which were used to
compile the GraphicsMagick wand library. Using compatible options ensures that
your program will compile and run.</p>
<hr class="docutils" />
<p>Copyright © GraphicsMagick Group 2009 - 2019</p>
</div>
</body>
</html>