Vignette bug

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Vignette bug

Post 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();
}
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Vignette bug

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Vignette bug

Post by magick »

We can reproduce the problem you posted and have a patch in IMageMagick 6.6.0-9 Beta available sometime tomorrow. Thanks.
Post Reply