#include #include #include #include #include using namespace std; using namespace Magick; int main(int argc, char **argv) { int i, x, y; try { list imageList; char * pixels = (char *) malloc(150 * 150 * 4); for (i = 0; i < 256; i++) { for (x = 0; x < 150; x++) { for (y = 0; y < 150; y++) { pixels[(x + y * 150) * 4 + 0] = i; pixels[(x + y * 150) * 4 + 1] = i; pixels[(x + y * 150) * 4 + 2] = i; pixels[(x + y * 150) * 4 + 3] = 255; } } imageList.push_back(Image(150, 150, "RGBA", CharPixel, pixels)); printf("Creating picture #%i\n", i); } printf("Dumping picture.\n"); writeImages(imageList.begin(), imageList.end(), "animation.gif"); list coalescedList; printf("Coalesce pictures.\n"); coalesceImages(&coalescedList, imageList.begin(), imageList.end()); printf("Dumping picture.\n"); writeImages(coalescedList.begin(), coalescedList.end(), "animation-coalesced.gif"); printf("Exitting.\n"); free(pixels); } catch(Exception & error_) { cout << "Caught exception: " << error_.what() << endl; return 1; } catch(exception & error_) { cout << "Caught exception: " << error_.what() << endl; return 1; } return 0; }