Skip to content
Console

Custom crop

All examples below use this original image: https://demo.bitiful.com/girl.jpeg

Parameters

ParameterMeaningFormat
rectCrop regionx,y,w,h: four values separated by ASCII commas
ComponentMeaningValues
x, yCoordinates of the region's top-left cornerPixels or a percentage; negative values are measured back from the right and bottom edges
w, hWidth and height of the regionPixels or a percentage; must be greater than 0
  • Percentages are relative to the original image's width and height. In URLs, write % as %25, for example rect=10%25,10%25,80%25,80%25.
  • Negative coordinates let you grab a region on the right or bottom without knowing the original dimensions: rect=-900,-900,900,900 is the bottom-right 900 × 900.
  • Any part of the region that extends beyond the image bounds is cut off, and the output is smaller accordingly.
  • rect runs before w and h: the image is cropped first, then resized.
  • HDR images remain HDR after cropping.

rect is for precise cropping by coordinates. To crop automatically to a target width and height while keeping faces or the main subject, use pos=smart in Resize images.

Examples

Demo: extract a 500 × 500 region from the top-left corner
Demo: extract a 1000 × 1000 region from the top-left corner, then resize to 500 wide

rect takes precedence over w and h, so processing happens in two steps:

  1. rect=0,0,1000,1000 extracts the 1000 × 1000 region at the top-left corner of the original image.
  2. w=500 resizes the result proportionally to 500 px wide.

URL: https://demo.bitiful.com/girl.jpeg? rect=0,0,1000,1000 & w=500

Cropped, then resized