Page 1 of 1

fill given area operator (^) not working?

Posted: 2016-03-06T13:33:55-07:00
by jlp2097
Hi,

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
However my program generates a file with the dimensions 1280x720. Does anyone know why this happens? My code:

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;
  }
}
Build line is

Code: Select all

g++ `Magick++-config --cxxflags --cppflags` -O3 -Wall -o thumbgenerator thumbgenerator.cpp `Magick++-config --ldflags --libs`
Version output of convert is
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org

Re: fill given area operator (^) not working?

Posted: 2016-03-07T15:01:31-07:00
by jlp2097
Solved it. Seems that even though that ImageMagick 6.7.7 is the latest version on Linux Mint, it is quite outdated. This version does not support the fillArea operator (but also does not complain about it). Updating to a recent Imagemagick version solved it.

Re: fill given area operator (^) not working?

Posted: 2016-03-08T15:31:18-07:00
by dlemstra
Thanks for coming back to the forum and posting how you solved it :)