Page 1 of 1

Save Montage to Blob with Magick++

Posted: 2013-02-11T07:50:40-07:00
by mobiljani
Hi.

I have a montage, and I can save it to disk when specified the destination path.
However when I try to save it to a Blob it fails.

Am I missing some settings?

Version: ImageMagick 6.8.2-5 2013-02-05 Q8
Machine: Windows 7 x64


The exception:
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Magick.Blob.updateNoCopy(Blob* , Void* , UInt32 , Allocator )
at Magick.writeImages<class std::_List_iterator<class std::_List_val<class Magick::Image,class std::allocator<class Magick::Image> > > >(_List_iterator<std::_List_val<Magick::Image\,std::allocator<Magick::Image> > > first_, _List_iterator<std::_List_val<Magick::Image\,std::allocator<Magick::Image> > > last_, Blob* blob_, Boolean adjoin_) in d:\dev\imagemagick\include8\magick++\stl.h:line 2558
The souce images:

http://torgyik.co.uk/montage/montage.rar

The Code:

Code: Select all

	void MontageMaker::Test()
	{
		list<Magick::Image> sourceImageList;
		Magick::Image image;

		image.read("d:\\imtest\\Montage\\1.jpg");
		sourceImageList.push_back(image);
		image.read("d:\\imtest\\Montage\\2.jpg");
		sourceImageList.push_back(image);
		image.read("d:\\imtest\\Montage\\3.jpg");
		sourceImageList.push_back(image);
		
		Magick::Color color("rgba(0,0,0,0)");

		Montage montageSettings;
		montageSettings.geometry("100x100-0-0");
		montageSettings.shadow(true);
		montageSettings.backgroundColor(color);
		montageSettings.tile( "3x1" );
		                       
		list<Magick::Image> montagelist;
		montageImages( &montagelist, sourceImageList.begin(), sourceImageList.end(), montageSettings);

		// OK
		writeImages(montagelist.begin(), montagelist.end(), "d:\\imtest\\Montage\\out.png");

		Magick::Blob *b;
		// Fail
		writeImages(montagelist.begin(), montagelist.end(), b);
		Magick::Image imageFromBlob(*b);
		imageFromBlob.write("d:\\imtest\\Montage\\outBlob.png");

	}