Imgix APIsRendering APISizeSource Rectangle Region

Source Rectangle Region

rect

By default, the entire image is used as the area for processing. The rect parameter selects a sub-region of the source image for processing before applying other resize operations.

The value for rect is four integers or relative values representing the starting coordinates (x and y) and the size (width and height), all separated by commas. This is represented as rect=x,y,w,h.

  • x: Accepts either an integer, float, or left, center, and right options. left is equivalent to 0, center is equivalent to half of the difference of the image width minus the rect width, and right is the difference between the image width minus the rect width. 0.5 positions the left edge of the rectangle at the center of the image.
  • y: Accepts either an integer, float, or top, middle, and bottom options. top is equivalent to 0, middle is equivalent to the half the difference of the image height minus the rect height, and bottom is equivalent to the difference of the image height minus the rect height. 0.5 positions the top edge of the rectangle at the center of the image.
  • w: can take either an integer (ex: 500) representing the pixel width, a float (ex: 0.5) representing the scalar width, or full, which is equivalent to the full width of the image.
  • h: can take either an integer (ex: 500) representing the pixel height, a float (ex: 0.5) representing the scalar height, or full, which is equivalent to the full height of the image.