| mirror.cxx |  | 
Mirror an image file (horizontal or vertical) 
 Usage: mirror infile outfile
#include <iostream>
#include <vigra/multi_array.hxx>
#include "vigra/stdimage.hxx"
using namespace vigra; 
int main(int argc, char ** argv)
{
    if(argc != 3)
    {
        std::cout << "Usage: " << argv[0] << " infile outfile" << std::endl;
        
        return 1;
    }
    
    int axis;
    std::cout << "Which axis? horizontal (1) or vertical (2): ";
    std::cin >> axis;
    
    try
    {
        
        
        
        {   
            
            
            
            if (axis == 1) {
                for (
int i=0; i<info.
height(); i++) {           
 
                        in.bind<1>(i) = tempImage.bind<1>(info.
height()-(i+1));
                }
            }
            
            if (axis == 2) {
                for (
int i=0; i<info.
width(); i++) {           
 
                        in.bind<0>(i) = tempImage.bind<0>(info.
width()-(i+1));
                }
            }    
            
            
            
        }
        else
        {
            
            
            
            
            if (axis == 1) {
                for (
int i=0; i<info.
height(); i++) {           
 
                        in.bind<1>(i) = tempImage.bind<1>(info.
height()-(i+1));
                }
            }
            
            if (axis == 2) {
                for (
int i=0; i<info.
width(); i++) {           
 
                        in.bind<0>(i) = tempImage.bind<0>(info.
width()-(i+1));
                }
            }
            
            
            
        }
    }
    catch (vigra::StdException & e)
    {
        
        std::cout << e.what() << std::endl;
        return 1;
    }
    
    return 0;
}