[ SOLVED ] ImageMagick 6.7.9-3 Cannot Resize

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
M4rtinch0
Posts: 2
Joined: 2012-09-10T13:56:40-07:00
Authentication code: 67789

[ SOLVED ] ImageMagick 6.7.9-3 Cannot Resize

Post by M4rtinch0 » 2012-09-10T14:59:26-07:00

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!
Last edited by M4rtinch0 on 2012-09-10T15:58:51-07:00, edited 1 time in total.

User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: ImageMagick 6.7.9-3 Cannot Resize

Post by magick » 2012-09-10T15:47:14-07:00

Did you call InitializeMagick(*argv)? If you do before you call any other Magick++ methods, it should resolve your exception.

M4rtinch0
Posts: 2
Joined: 2012-09-10T13:56:40-07:00
Authentication code: 67789

Re: ImageMagick 6.7.9-3 Cannot Resize

Post by M4rtinch0 » 2012-09-10T15:58:24-07:00

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!

Post Reply