Page 1 of 1

[ SOLVED ] ImageMagick 6.7.9-3 Cannot Resize

Posted: 2012-09-10T14:59:26-07:00
by M4rtinch0
Hello everyone! Im using the lastest version of ImageMagick (6.7.9-3) with Magick++, I compiled my self (Debian Wheezy Kernel 3.2.21):

Code: Select all

./configure --prefix=/opt/imagemagick
I'm developing an application in C++ for resizing and throws me an error I can not solve:
This is a portion of my code:

Code: Select all

try
{
	try
	{
		// Try reading image file
		o_ImageMagick.read( m_strSourcePath );
	}
	catch( Magick::WarningCoder &warning )
	{
		// Magick++ warning.
		cerr << "Coder Warning: " << warning.what() << endl;
	}
	catch( Magick::Warning &warning )
	{
		// Other Magick++ warning.
		cerr << "Warning: " << warning.what() << endl;
	}
	catch( Magick::ErrorFileOpen &error )
	{
		// Magick++ file open error
		cerr << "Error: " << error.what() << endl;
	}
	try
	{
		o_ImageMagick.resize( newSize );          //Program Hangs HERE!
		o_ImageMagick.type( TrueColorType );
		if( m_dRotate != 0 ) o_ImageMagick.rotate( m_dRotate );
		o_ImageMagick.write( m_strOutputPath );
	}
	catch( Magick::Exception & error)
	{
		cerr << "Magick++ exception: " << error.what() << endl;
	}
}
catch( std::exception &error )
{
	// Standard C++ exception
	cerr << "STD exception: " << error.what() << endl;
}
catch( ... )
{
	// Process other exceptions 
}
Then the aplication is compiled with this:

Code: Select all

g++-4.7 -ggdb -Wall -O2 -o ImageConvert -fopenmp -I/opt/imagemagick/include/ImageMagick -lMagick++ -lMagickCore  ... etc
The program runs OK until the o_ImageMagick.resize( newSize ); Then hangs and throws this error:

Code: Select all

ImageConvert: magick/cache-view.c:729: GetCacheViewVirtualPixels: Assertion `id < (int) cache_view->number_threads' failed.
And some times it only says Segmentation Fault

Thanks in advance!
Martin!

Re: ImageMagick 6.7.9-3 Cannot Resize

Posted: 2012-09-10T15:47:14-07:00
by magick
Did you call InitializeMagick(*argv)? If you do before you call any other Magick++ methods, it should resolve your exception.

Re: ImageMagick 6.7.9-3 Cannot Resize

Posted: 2012-09-10T15:58:24-07:00
by M4rtinch0
OMG You rule! I had read in the documentation that it was sometimes necessary for Windows and sometimes for Mac, so I assumed that in Linux was not necessary to put it.
Anyway thank you very much!