An example in magick++ would look something like...
#include <Magick++.h>
#include <vector>
int main(int argc, const char * argv[]) {
std::vector<Magick::Image> images;
Magick::Image input, output;
// Create example image
input.size(Magick::Geometry(100, 100));
input.read("GRADIENT:GREEN-TRANSPARENT");
// Set background color
input.backgroundColor(Magick::Color("RED"));
// Add image to list
images.push_back(input);
// Perform flatten operation
Magick::flattenImages(&output, images.begin(), images.end());
// Safe to disk
output.write("output.png");
return 0;
}
Which would convert an image like...
to
The key thing to understand is that Magick++ has Standard Template Libary with many helper methods, and most methods expected a list(vector) of images to act on. If you can't find what you need on the Magick::Image
class, then it's probably over on the STL.