Image Processing Supports Focal Point Crop
We've extended our Image Processing service with a new focal point crop feature! It adds to our exisiting crop
operation by allowing an image crop and an optional zoom at certain coordinates of the image. The coordinates can be absolute or relative to the image dimensions. An extra debug parameter displays the coordinates on the image in order to find the right position for the crop. Any image processing operation can be used in combination with focal point crop.
Focal point crop parameter overview
The following image processing parameters have been added to the crop
operation:
fp
defines the focal point functionality as part of crop.fp-x
andfp-y
can either be integer between1
-4000
or float between0
-1
. Integer defines the absolute number of pixels on the horizontal (x) and vertical (y) axis. A float value defines the relative coordinates to the base image.fp-z
specifies the zoom level of the cropped area.fpd
enables the debug level and displays a red hairline cross on the image.width
andheight
parameters are both mandatory for any focal point crop operation and define the output dimensions of the cropped area.
In order to use the crop operation with focal point, the Image Processing setting needs to be enabled
.
Focal point crop examples
A basic focal point crop contains the x
and y
coordinates as well as width
and height
:
https://ip.keycdn.com/example.jpg?crop=fp,0.40,0.70&width=800&height=100
The x
and y
coordinates can also be in absolute values:
https://ip.keycdn.com/example.jpg?crop=fp,100,300&width=800&height=100
The zoom level can be added as an extra parameter:
https://ip.keycdn.com/example.jpg?crop=fp,0.40,0.70,2.2&width=800&height=400
In the debugging mode, a red hairline cross is added to the image:
https://ip.keycdn.com/example.jpg?crop=fpd,0.40,0.70&width=800&height=400
Summary
Focal point crop is a powerful feature to efficiently crop and zoom an image at exact coordinates. It only takes a few query string parameters to transform an image. If there is another feature that you're looking for we'd love to hear your feedback.
Happy image transforming!