Image Processing Supports Focal Point Crop

By Martin Williams
Published on December 5, 2019
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 and fp-y can either be integer between 1-4000 or float between 0-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 and height 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!

  • Share

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started

Comments

Comment policy: Comments are welcomed and encouraged. However, all comments are manually moderated and those deemed to be spam or solely promotional in nature will be deleted.
  • **bold**
  • `code`
  • ```block```
KeyCDN uses cookies to make its website easier to use. Learn more