I help maintain libvips, a free, cross-platform C/C++ scientific image-processing library. It is fast and works well on very large images.
I did a very simple benchmark: load a 10,000 x 10,000 pixel RGB tif, crop 100 pixels off every edge, shrink 10%, sharpen, and save again. On this trivial test at least, vips is more than twice as fast as anything else I've tried.
The C++ API is documented here. For example:
#include <vips/vips8>
using namespace vips;
int
main( int argc, char **argv )
{
// startup, load plugins, init support libraries, etc.
if (VIPS_INIT(argv[0]))
vips_error_exit(NULL);
// the "sequential" access hint means we plan to only read this image
// top-to-bottom (eg. no 90 degree rotates) ... this means libvips can
// stream the image and run decode and processing in
// parallel on separate threads
VImage image = VImage::new_from_file(argv[1],
VImage::option()->set("access", "sequential"));
// shrink to 20% and find the histogram
VImage hist = image.resize(0.2).hist_find();
hist.write_to_file(argv[2]);
return 0;
}
You can run this program with any input and output image format, for example:
$ g++ -g -Wall resize.cpp `pkg-config vips-cpp --cflags --libs`
$ ./a.out ~/pics/wtc.jpg x.csv
And it'll read the JPG input and write the histogram to the CSV file.