I am trying to resize an image with the dimensions 3264x1836 with the Geometry specification 1280x1280^. The expected output is a file with the dimensions 2276x1280. This works fine when using command-line convert:
Code: Select all
convert 160102-IMG_20160102_122843.jpg -resize 1280x1280^ test.jpg
Code: Select all
#include <cstring>
#include <iostream>
#include <string>
#include <libgen.h>
#include <Magick++.h>
#include <sys/stat.h>
using namespace std;
using namespace Magick;
int main (int, char **argv)
{
InitializeMagick (*argv);
Image im;
string src = argv[1];
try
{
im.read (src);
im.resize ("1280x1280^"); //XL: max. 1280
im.write ("test.jpg");
}
catch (const std::exception & e)
{
cerr << e.what () << endl;
}
}
Code: Select all
g++ `Magick++-config --cxxflags --cppflags` -O3 -Wall -o thumbgenerator thumbgenerator.cpp `Magick++-config --ldflags --libs`
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org