flip.cpp
Go to the documentation of this file.
// This may look like C code, but it is really -*- C++ -*-
//
// Copyright Bob Friesenhahn, 1999, 2003
//
// Copyright @ 2013 ImageMagick Studio LLC, a non-profit organization
// dedicated to making software imaging solutions freely available.
//
// Demonstration of unary function-object based operations
//
// Reads the multi-frame file "smile_anim.miff" and writes a
// flipped and morphed version to "flip_out.miff".
//
#include <Magick++.h>
#include <string>
#include <iostream>
#include <list>
#include <algorithm>
using namespace std;
using namespace Magick;
int main( int /*argc*/, char ** argv)
{
// Initialize ImageMagick install location for Windows
InitializeMagick(*argv);
try {
string srcdir("");
if(getenv("SRCDIR") != 0)
srcdir = getenv("SRCDIR");
// Read images into STL list
list<Image> imageList;
readImages( &imageList, srcdir + "smile_anim.miff" );
// cout << "Total scenes: " << imageList.size() << endl;
// Flip images
for_each( imageList.begin(), imageList.end(), flipImage() );
// Create a morphed version, adding three frames between each
// existing frame.
list<Image> morphed;
morphImages( &morphed, imageList.begin(), imageList.end(), 3 );
// Write out images
cout << "Writing image \"flip_out.miff\" ..." << endl;
writeImages( morphed.begin(), morphed.end(), "flip_out.miff" );
}
catch( exception &error_ )
{
cout << "Caught exception: " << error_.what() << endl;
return 1;
}
return 0;
}
std
STL namespace.
Magick++.h
Magick::writeImages
void writeImages(InputIterator first_, InputIterator last_, const std::string &imageSpec_, bool adjoin_=true)
Definition: STL.h:2823
Magick::readImages
void readImages(Container *sequence_, const std::string &imageSpec_, ReadOptions &options)
Definition: STL.h:2735
main
int main(int, char **argv)
Definition: flip.cpp:24
Magick::morphImages
void morphImages(Container *morphedImages_, InputIterator first_, InputIterator last_, size_t frames_)
Definition: STL.h:2538
Magick::flipImage
Definition: STL.h:449
Magick
Definition: Blob.h:17
Magick::InitializeMagick
MagickPPExport void InitializeMagick(const char *path_)
Definition: Functions.cpp:45