Page 1 of 1

Magick++ Image::composite() - does not composes iteratively.

Posted: 2007-01-21T08:02:08-07:00
by Bunkai
I need to compose one large file with transparency (matte layer) consisting from hundreds of small pictures. I noticed that after creating a loop structure for this, i did not get composed image. Therefore I did an expermient trying to compose two pictures, one by one, into large file. I notices, that Image::Compose() function inserts always only first image, and the subsequent ones never get composed, but, ont he second insertion, compose function even erases the content of the imageOutputSpriteFile. This occurs only if imageOutputSpritesFile->matte() is true. If it is false, then everything works, however, then, i can not compose images with transparency. Is it a bug, or is an errror in my code? The code is below:

Magick::Image *imageOutputSpritesFile = new Magick::Image;
Magick::Geometry imageOutputSize(480, 200);
imageOutputSpritesFile->size(imageOutputSize);
imageOutputSpritesFile->matte(true);

Magick::Image *imageSprite = new Magick::Image;
imageSprite->read("MainLeftFire0033.png");

imageOutputSpritesFile->composite(*imageSprite, 0, 0);
imageOutputSpritesFile->write("compostition1.png");

imageOutputSpritesFile->composite(*imageSprite, 35, 0);
imageOutputSpritesFile->write("composition2.png");