#include <iostream>
#include <vigra/multi_array.hxx>
#include <vigra/stdimagefunctions.hxx>
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]);
int sub_x0 = info.width() / 4;
int sub_y0 = info.height() / 4;
int sub_x1 = info.width() - sub_x0;
int sub_y1 = info.height() - sub_y0;
if(info.isGrayscale())
{
MultiArray<2, UInt8> in(info.width(), info.height());
MultiArrayView<2, UInt8> out = in.subarray(Shape2(sub_x0, sub_y0), Shape2(sub_x1, sub_y1));
}
else
{
MultiArray<2, RGBValue<UInt8> > in(info.width(), info.height());
MultiArrayView<2, RGBValue<UInt8> > out = in.subarray(Shape2(sub_x0, sub_y0), Shape2(sub_x1, sub_y1));
}
}
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.