class Chevalet::Filters::Crop

Crop the image to a specified rectangular area.

Parameters

gravity

A gravity value specifying the position of the crop area. See Chevalet::Filters for information on gravity.

x, y

The x- and y-offsets of the crop area in pixels from the sides as determined by the gravity parameter.

width, height

The width and height of the crop area in pixels.

Examples

Crop a square out of the center of the image:

[{
  "filter": "crop",
  "params": { "gravity": "center", "width": 350, "height": 350 }
}]

Crop a wide area from the bottom right of the image:

[{
  "filter": "crop",
  "params": { "gravity": "south_east", "width": 400, "height": 100 }
}]

Crop a 50x50-pixel area from the top right-hand corner of the image, offset from the top by five pixels and the right by ten pixels:

[{
  "filter": "crop",
  "params": {
    "gravity": "north_east",
    "width": 50,
    "height": 50,
    "x": 10,
    "y": 5
  }
}]

Constants

DefaultParams