ImageMagick-nox11: 6.9.2.3,1 -> 6.9.4.3,1
pecl-imagick: 3.1.2_2 -> 3.4.1
Full version info:
Version: ImageMagick 6.9.4-3 Q16 amd64 2016-05-24 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib fontconfig fpx jbig jng jp2 jpeg lcms ltdl png xml zlib
Using PHP, in the past I have always been able to use
Code: Select all
convert -auto-orient 'file' 'newfile'
Code: Select all
$imagick = new Imagick();
//Read in the image
$imagick->readImage($fileLocation);
//Rotate the Image according to its EXIF info
$imagick = AutoRotate($imagick);
//Save the image
$imagick->writeImage();
$imagick->clear();
function AutoRotate(Imagick $image)
{
switch ($image->getImageOrientation()) {
case Imagick::ORIENTATION_TOPLEFT:
break;
case Imagick::ORIENTATION_TOPRIGHT:
$image->flopImage();
break;
case Imagick::ORIENTATION_BOTTOMRIGHT:
$image->rotateImage("#000", 180);
break;
case Imagick::ORIENTATION_BOTTOMLEFT:
$image->flopImage();
$image->rotateImage("#000", 180);
break;
case Imagick::ORIENTATION_LEFTTOP:
$image->flopImage();
$image->rotateImage("#000", -90);
break;
case Imagick::ORIENTATION_RIGHTTOP:
$image->rotateImage("#000", 90);
break;
case Imagick::ORIENTATION_RIGHTBOTTOM:
$image->flopImage();
$image->rotateImage("#000", 90);
break;
case Imagick::ORIENTATION_LEFTBOTTOM:
$image->rotateImage("#000", -90);
break;
default: // Invalid orientation
break;
}
$image->setImageOrientation(Imagick::ORIENTATION_TOPLEFT);
return $image;
}
Code: Select all
convert -rotate 90 'file' 'newFile'
Here is an example image and the results:
Original image:
After rotation:
Thanks!