Vignette bug
Posted: 2010-03-22T09:37:42-07:00
There's a bug somewhere in the VignetteImage code. If the x and y arguments to MagickVignetteImage are both greater than half the width (x) and height (y) of the image, the program crashes. So far my tests seem to show that if only one of them is greater, it won't crash. I've appended a test function with values which crash.
Pete
Pete
Code: Select all
#include <windows.h>
#include <wand/magick_wand.h>
void test_wand(LPTSTR lpCmdLine)
{
MagickWand *m_wand = NULL;
PixelWand *p_wand = NULL;
int w,h;
MagickWandGenesis();
m_wand = NewMagickWand();
MagickReadImage(m_wand,"logo:");
w = MagickGetImageWidth(m_wand);
h = MagickGetImageHeight(m_wand);
p_wand = NewPixelWand();
PixelSetColor(p_wand,"black");
MagickSetImageBackgroundColor(m_wand,p_wand);
MagickVignetteImage(m_wand,0,175,(long)(w*.51),(long)(h*.51));
// Set the compression quality to 95 (high quality = low compression)
MagickSetImageCompressionQuality(m_wand,95);
/* Write the image */
MagickWriteImage(m_wand,"logo_vig.jpg");
/* Clean up */
if(m_wand)m_wand = DestroyMagickWand(m_wand);
MagickWandTerminus();
}