cropAroundFocalPoint()

Overview

public any function cropAroundFocalPoint(
      required any     image     
    , required numeric width     
    , required numeric height    
    , required string  focalPoint
)

Crops an image to new dimensions, while ensuring that the asset's focal point (if defined) is as close to the centre of the image as possible.

Arguments

NameTypeRequiredDescription
imageanyYesImage object (generally already scaled)
widthnumericYesWidth of the crop area, in pixels
heightnumericYesHeight of the crop area, in pixels
focalPointstringYesCoordinates of the image's focal point. Comma-separated x,y - where each coordinate is a value between 0 and 1, the offset of the point from the top left corner of the image. So "0.5,0.5" would place the focal point in the centre of the image.