* Create a black opaque image
* Write the text onto it in white.
This gives us our alpha channel. Next...
* Create an opaque white image
* Use this white image as the R,G and B of a new combined image. And use the Black/White text image as its alpha.
Here's how I did this.
Code: Select all
Magick::Image txtImage;
txtImage.magick("RGBA");
Magick::Image whiteImage;
whiteImage.magick("RGBA");
std::vector<Magick::Image> imagesList; // The list of images that will form the new combined image
imagesList.push_back(whiteImage.separate(Magick::RedChannel)); // Will be used for R
imagesList.push_back(whiteImage.separate(Magick::GreenChannel)); // Will be used for G
imagesList.push_back(whiteImage.separate(Magick::BlueChannel)); // Will be used for B
imagesList.push_back(txtImage); // Will be used for Alpha
Magick::Image combinedImages;
combinedImages.magick("RGBA");
Magick::combineImages( &combinedImages, imagesList.begin(), imagesList.end( ), Magick::AllChannels );
Hope this is of help to someone