image
image copied to clipboard
Automatic or manual rotation of the image according to EXIF orientation
Images can contain EXIF information for camera rotation. This information is read by Intervention Image and an alignment (rotation) is performed based on it. Since version 3 this happens automatically when new image instances are decoded. In version 2, the orientation had to be triggered manually using the orientate() method.
While this may seem convenient, it may not always be desirable. Especially for very large image formats, rotation can consume alot of memory and processing time, which is not always utilized. See #1278
A return to manual auto-alignment after EXIF camera rotation should be discussed.
Keep in mind that a return to manual, will be a breaking change.
What do you think?
I'm not very familiar with the internal codes of Intervention Image, but I think if you use a flag/option variable with a correct default value, you can keep current behavior and avoid breaking change. something like this:
$image = $manager->read($filePath, FilePathImageDecoder::class, false) read(mixed $input, string|array|DecoderInterface $decoders = [], bool $autoExifRotate = true) OR $image = $manager->read($filePath, FilePathImageDecoder::class, ['autoExifRotate' => false]) read(mixed $input, string|array|DecoderInterface $decoders = [], array $options= ['autoExifRotate' => true])
+1 for this.
Any updates on this, would love to have not autorotate my images.
This feature is available from version 3.7.0.
As of this version, it is possible to configure the ImageManager globally. The autoOrientation
option can be used to disable automatic exif alignment in the decoding process.
Example
use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Imagick\Driver;
// disable animation decoding in config
$manager = new ImageManager(
Driver::class,
autoOrientation: false // disable automatically alignment based on exif data.
);
// read image is not aligned ...
$image = $manager->read('test.jpg');
// ... but can be aligned manually at a later time
$image->orient();