Page 1 of 1

mosaicImages with transparent background problem

Posted: 2013-10-17T06:35:30-07:00
by RayR
Hi,

I am having problem to create a flatten image with transparent background when using either flattenImages or mosaicImages function.

Code: Select all

std::list<Magick::Image> images;
images.push_back("image1.png");
images.push_back("image2.png");

Magick::Image resultImage;
mosaicImages(&resultImage, images.begin(), images.end());

resultImage.write("test_result.png");
note: image1 is not fully contained image2, so the resultImage should have some transparent pixels.

my problem is whenever I use mosaicImages(), all i get is the flatten image with white background. I also tried use

Code: Select all

resultImage.backgroundColor(Magick::Color(0,0,0,0));
mosaicImages(&resultImage, images.begin(), images.end());
but i still get the white background.

Is there any way i can set the background color?

Thanks advance for help

Re: mosaicImages with transparent background problem

Posted: 2013-11-05T14:39:07-07:00
by dlemstra
You should change the background color of your first image.