#include <iostream>
#include <vigra/multi_array.hxx>
#include <vigra/stdimagefunctions.hxx>
#include <vigra/multi_math.hxx>
#include <string.h>
int main(int argc, char ** argv)
{
if(argc != 3)
{
std::cout << "Usage: " << argv[0] << " infile outfile" << std::endl;
return 1;
}
try
{
ImageImportInfo info(argv[1]);
if(info.isGrayscale())
{
MultiArray<2, UInt8> in(info.width(), info.height()),
out(info.width(), info.height());
using namespace multi_math;
out = 255 - in;
if(strcmp(argv[2], "-") == 0)
{
exportImage(out, ImageExportInfo(argv[2]).setFileType(info.getFileType()));
}
else
{
}
}
else
{
MultiArray<2, RGBValue<UInt8> > in(info.width(), info.height()),
out(info.width(), info.height());
using namespace multi_math;
out = RGBValue<int>(255) - in;
if(strcmp(argv[2], "-") == 0)
{
ImageExportInfo(argv[2]).setFileType(info.getFileType()));
}
else
{
}
}
}
catch (std::exception & e)
{
std::cout << e.what() << std::endl;
return 1;
}
return 0;
}
void importImage(...)
Read an image from a file.
void exportImage(...)
Write an image to a file.
image import and export functions
std::string impexListFormats()
List the image formats VIGRA can read and write.
LinearIntensityTransform< DestValueType, Multiplier > linearIntensityTransform(Multiplier scale, DestValueType offset)
Apply a linear transform to the source pixel values.
Definition: transformimage.hxx:800