// Last updated 2008/11/25 08:48
/*
Use MagickTransparentPaintImage to change *all* white pixels
to transparent in the logo: image
*/
#include <windows.h>
#include <wand/magick_wand.h>
void test_wand(LPTSTR lpCmdLine)
{
MagickWand *magick_wand = NULL;
// Set default fuzz to zero (see below)
double fuzz = 0.;
PixelWand *target;
MagickWandGenesis();
magick_wand = NewMagickWand();
MagickReadImage(magick_wand,"logo:");
// A larger fuzz value allows more colours "near" white to be
// modified. A fuzz of zero only allows an exact match with the
// given colour
fuzz = 10.;
// Set up the pixelwand containing the colour to be "targeted"
// by transparency
target = NewPixelWand();
PixelSetColor(target,"white");
// Change the transparency of all colours which match target (with
// fuzz applied). In this case they are made completely transparent (0)
// but you can set this to any value from 0 to 1.
MagickTransparentPaintImage(magick_wand,target,0,fuzz,MagickFalse);
MagickWriteImage(magick_wand,"logo_white.png");
/* Clean up */
if(magick_wand)magick_wand = DestroyMagickWand(magick_wand);
if(target) target = DestroyPixelWand(target);
MagickWandTerminus();
}