Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
jtkangas
Posts: 5 Joined: 2015-12-21T05:19:56-07:00
Authentication code: 1151
Post
by jtkangas » 2015-12-21T05:26:35-07:00
Convert with flop, rotate and crop not working anymore as expected, resulting image is not what it used to be.
This used to work with version 6.6.9-7 (Ubuntu 12.04)
Code: Select all
convert -flop -rotate -26 -crop 1372x1212+1730+953 original.jpg new.jpg
With version 6.9.2-4 (Mac OS X) it works if the crop is done separately:
Code: Select all
convert -flop -rotate -26 original.jpg tmp.jpg
convert -crop 1372x1212+1730+953 tmp.jpg new2.jpg
dlemstra
Posts: 1570 Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:
Post
by dlemstra » 2015-12-21T05:34:30-07:00
What happens when you execute the command in the correct order?
Code: Select all
convert original.jpg -flop -rotate -26 -crop 1372x1212+1730+953 new.jpg
jtkangas
Posts: 5 Joined: 2015-12-21T05:19:56-07:00
Authentication code: 1151
Post
by jtkangas » 2015-12-21T05:37:20-07:00
Same error.
jtkangas
Posts: 5 Joined: 2015-12-21T05:19:56-07:00
Authentication code: 1151
Post
by jtkangas » 2015-12-21T06:45:27-07:00
Following PHP code results same erroneous image Mac OS X (port install php55-imagick), works with Ubuntu 12.04LTS (apt-get install php5-imagick).
Code: Select all
<?php
$inputfile = 'original.jpg';
$outputfile = 'output.jpg';
if(!class_exists('Imagick')) {
echo "ImageMagick extension missing. Aborting.\n";
exit(1);
}
$imagick = new \Imagick(realpath($inputfile));
$imagick->flopImage();
$imagick->rotateImage(new ImagickPixel('#FFFFFF'),-26);
$imagick->cropImage(1372,1212,1730,953);
$imagick->writeImage($outputfile);
jtkangas
Posts: 5 Joined: 2015-12-21T05:19:56-07:00
Authentication code: 1151
Post
by jtkangas » 2015-12-21T06:55:51-07:00
And if file is written to temporary file after crop and rotate, it works with Mac (or newer ImageMagick version) as well:
Code: Select all
<?php
$inputfile = 'original.jpg';
$tmpfile = 'tmp.jpg';
$outputfile = 'output2.jpg';
if(!class_exists('Imagick')) {
echo "ImageMagick extension missing. Aborting.\n";
exit(1);
}
$imagick = new \Imagick(realpath($inputfile));
$imagick->flopImage();
$imagick->rotateImage(new ImagickPixel('#FFFFFF'),-26);
$imagick->writeImage($tmpfile);
$imagick = new \Imagick(realpath($tmpfile));
$imagick->cropImage(1372,1212,1730,953);
$imagick->writeImage($outputfile);
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2015-12-21T10:18:54-07:00
I do not see any problem with the following command on IM 6.9.2.9 Q16 Mac OSX
Code: Select all
convert logo: -flop -rotate -26 -crop 200x200+150+150 +repage result.png
jtkangas
Posts: 5 Joined: 2015-12-21T05:19:56-07:00
Authentication code: 1151
Post
by jtkangas » 2016-04-28T01:09:13-07:00
In order to get same result as with previous version +repage needs to be before the crop:
Code: Select all
convert original.jpg -flop -rotate -26 +repage -crop 1372x1212+1730+953 new.jpg
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2016-04-28T09:59:09-07:00
The +repage is supposed to be after -crop to remove the virtual canvas. I see no point in having it before -crop.