2 // Replace transparency in an image with a solid color using Magick++
4 // Useful to see how a transparent image looks on a particular
5 // background color, or to create a similar looking effect without
8 // Copyright Bob Friesenhahn, 2000
10 // Usage: detrans color file...
16 using namespace Magick;
17 int main(int argc,char **argv)
21 cout << "Usage: " << argv[0] << " background_color file..." << endl;
25 // Initialize ImageMagick install location for Windows
26 InitializeMagick(*argv);
31 color = Color(argv[1]);
33 catch ( Exception error_ )
35 cout << error_.what() << endl;
40 char **arg = &argv[2];
45 Image overlay( fname );
46 Image base( overlay.size(), color );
47 base.composite( overlay, 0, 0, OverCompositeOp );
51 catch( Exception &error_ )
53 cout << error_.what() << endl;