Page 1 of 1

Vignette bug

Posted: 2010-03-22T09:37:42-07:00
by el_supremo
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

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();
}

Re: Vignette bug

Posted: 2010-03-22T09:44:11-07:00
by fmw42
verified in command line mode on IM 6.6.0-8 Q16 Mac OSX Tiger

# this works to produce a white to black radial-like gradient
convert -size 100x100 xc:white -background black -vignette 54x15 tmp.png

# this works but makes a totally black image
convert -size 100x100 xc:white -background black -vignette 54x15+50+50 tmp3.png


convert -size 100x100 xc:white -background black -vignette 54x15+75+75 tmp4.png
Segmentation fault

However, I suspect the latter two are meaningless situations producing non-useful results.

Re: Vignette bug

Posted: 2010-03-22T18:16:32-07:00
by magick
We can reproduce the problem you posted and have a patch in IMageMagick 6.6.0-9 Beta available sometime tomorrow. Thanks.