


  

  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  



  

    

      

        
../index.html[ImageMagick] 
        

        
http://www.imagemagick.org/[sponsor] 
        

        
../index.html 
        
../index.html 
      

    

  


  

  


    

      

      
#mainSkip to page contents 

      
[
      
../index.htmlAbout ImageMagick       
../www/command-line-tools.htmlCommand-line Tools       
../www/api.htmlProgram Interfaces   
][
      
../www/install-source.htmlInstall from Source       
../www/binary-releases.htmlBinary Releases       
../www/resources.htmlResources   
][
      
../www/download.htmlDownload   
][
      
../www/links.htmlLinks   
][
      
../www/sponsors.htmlSponsors   
http://www.travelsur.net/Trips to Argentina       
]
      


      

The MagickWand API is the recommended interface between the C programming language and the ImageMagick image processing libraries.  Unlike the ../www/magick-core.htmlMagickCore  C API, MagickWand uses only a few opaque types.  Accessors are available to set or get important wand attributes.  A description of the MagickWand public methods are found here:
  
../www/api/magick-wand.htmlMagick Wand Methods   
../www/api/magick-attribute.htmlSet or Get Magick Wand Attributes   
../www/api/magick-image.htmlMagick Wand Image Methods   
../www/api/pixel-iterator.htmlPixel Iterator Methods   
../www/api/pixel-wand.htmlPixel Wand Methods   
../www/api/drawing-wand.htmlImage Vector Drawing After you write your MagickWand program, compile it like this:
  cc `Wand-config --cflags --cppflags` wand.c `Wand-config --ldflags --libs`
Here is a example program that utilizes the MagickWand API to get you started, ../www/source/wand.cwand.c . It reads a GIF image, creates a thumbnail, and writes it to disk in the PNG image format.
  #include <stdio.h>
  #include <wand/magick-wand.h>
  
  int main(int argc,char **argv)
  {
  #define ThrowWandException(wand) \
  { \
    char \
      *description; \
   \
    ExceptionType \
      severity; \
   \
    description=MagickGetException(wand,&severity); \
    (void) fprintf(stderr,"%s %s %ld %s\n",GetMagickModule(),description); \
    description=(char *) MagickRelinquishMemory(description); \
    exit(-1); \
  }
  
    MagickBooleanType
      status;
  
    MagickWand
      *magick_wand;
  
    /*
      Read an image.
    */
    MagickWandGenesis();
    magick_wand=NewMagickWand();  
    status=MagickReadImage(magick_wand,"image.gif");
    if (status == MagickFalse)
      ThrowWandException(magick_wand);
    /*
      Turn the images into a thumbnail sequence.
    */
    MagickResetIterator(magick_wand);
    while (MagickNextImage(magick_wand) != MagickFalse)
      MagickResizeImage(magick_wand,106,80,LanczosFilter,1.0);
    /*
      Write the image as MIFF and destroy it.
    */
    status=MagickWriteImages(magick_wand,"image.png",MagickTrue);
    if (status == MagickFalse)
      ThrowWandException(magick_wand);
    magick_wand=DestroyMagickWand(magick_wand);
    MagickWandTerminus();
    return(0);
  }
      

      
 
    

  

  

  

    
http://redux.imagemagick.org/discussion-serverDiscourse Server  |
    
../www/mailing-list.htmlMailing Lists  |
    
http://redux.imagemagick.org/galleryImage Gallery  |
    
http://net11.imagemagick.org/MagickStudio/scripts/MagickStudio.cgiImageMagick Studio 
  

  

    
© 1999-2005 ImageMagick Studio LLC
  

  



