This options specifies the degrees by which the output image has to be rotated. Or it can be used to automatically correct the orientation of the image using the image metadata.
Currently, for specifying the degrees of rotation, only 4 values are supported - 90, 180, 270 and 360. Auto-orientation has been discussed later in this article.
'angle' can be 90, 180, 270 or 360
1. Image resized to 200x200 and rotated by 90 degrees
The rotation transformation supports a special value "auto", that automatically corrects the image orientation using the EXIF orientation tag in the image metadata. This option is also available as a dashboard setting, under "Image Settings" > "Advanced".
If the auto orientation setting in the dashboard is not enabled and rt-auto is not used in the image URL, the default behavior in ImageKit is that all the image metadata, which also includes the EXIF orientation tag, is removed to make the image smaller for delivery. This means that the image would be displayed in an incorrect orientation to your users.
This is where auto-orientation is really handy. It corrects the orientation of the image, then removes the image metadata, thereby achieving a small size while maintaining the correct orientation. Note, that you can also achieve correct orientation by preserving all metadata in the image, but it would result in a larger image size.
Let's take a look at an example
This is the original image (taken from Exif orientation examples on Github)
As can be seen from the image above, the orientation is incorrect. With auto-orientation, this is how the image URL looks like
Note that, we are using the demo account here for the example. The demo account also has auto-orientation enabled from the default image settings. Thus, even if you remove rt-auto from the URL, it would still orient correctly.
If you have any questions about the above transformations, please reach out to us by creating a support ticket from your ImageKit dashboard.