CropOptions: {
    gravity?: {
        offset?: {
            x: number;
            y: number;
        };
        type: GravityType;
    };
    height?: number;
    width?: number;
}

The available options for the crop operation

Type declaration

  • Optionalgravity?: {
        offset?: {
            x: number;
            y: number;
        };
        type: GravityType;
    }

    (Optional) The gravity for the cropping operation

    • Optionaloffset?: {
          x: number;
          y: number;
      }

      (Optional) Specifies the offset by X and Y axes

      • x: number

        The gravity offset on the X axis

      • y: number

        The gravity offset on the Y axis

    • type: GravityType

      Specifies the gravity type

  • Optionalheight?: number

    The height of the cropped size

    if height == 0 or unset : imgproxy uses the full height
    if height >= 1          : imgproxy treats it as absolute value
    if height <= 1          : imgproxy treats it as relative value
    
  • Optionalwidth?: number

    The width of the cropped size

    if width == 0 or unset : imgproxy uses the full width
    if width >= 1          : imgproxy treats it as absolute value
    if width <= 1          : imgproxy treats it as relative value