我有一个蒙太奇,我可以在指定目标路径时将它保存到磁盘。但是当我尝试将它保存到 Blob 时它失败了。
我错过了一些设置吗?
版本:ImageMagick 6.8.2-5 2013-02-05 Q8
机器:Windows 7 x64
编辑:例外:
Unhandled Exception: System.Runtime.InteropServices.SEHException: External component has thrown an exception.
at Magick.throwException(_ExceptionInfo* )
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\projects\ecs\layers\tools\imagemagicknet\include8\magick++\stl.h:line 2562
编码:
void 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;
Magick::montageImages( &montagelist, sourceImageList.begin(), sourceImageList.end(), montageSettings);
// This will give the expected result
Magick::writeImages(montagelist.begin(), montagelist.end(), "d:\\imtest\\Montage\\out.png");
Magick::Blob *b = new Magick::Blob();
// This will throw an exception mentioned above
Magick::writeImages(montagelist.begin(), montagelist.end(), b);
Magick::Image imageFromBlob(*b);
imageFromBlob.write("d:\\imtest\\Montage\\outBlob.png");
}