Skip to content
Browse all functions

Crop an Image by x, y, Width and Height

images/cropimage

cropimage (Crop an Image by x, y, Width and Height) is a 1001fx API function in the group Images: POST https://api.1001fx.com/images/cropimage, 3 credits per call. It works as a ready-made module in Make and n8n or as a plain HTTP call.

3 credits per callHTTP APIn8nMake

Crops an image to the region given by x, y, width and height. Without values it starts at 0, 0 and keeps the full width and height.

Try it in the 1001fx app

Run cropimage in your browser with your API key – fill the form, click Run and get the answer or the file.

cropimage in the 1001fx app: the form with example values
Crop an Image by x, y, Width and Height in the 1001fx app

Endpoint

POSThttps://api.1001fx.com/images/cropimage
Header
X-API-KEY: YOURSECRETAPIKEY How to
Content type
multipart/form-data

Parameters

  • xnumberoptional

    The x coordinate to crop from. Defaults to 0.

    Default:
    0
    Example:
    25
  • ynumberoptional

    The y coordinate to crop from. Defaults to 0.

    Default:
    0
    Example:
    25
  • widthnumberoptional

    The width of the crop region. Defaults to the images width.

    Example:
    25
  • heightnumberoptional

    The height of the crop region. Defaults to the images height.

    Example:
    25
  • filefilerequired

    Image file to be processed.

Examples

Image crop

Returns a cropped image

Input

Expects one image file named as file parameter: file
{
  "x": "200",
  "y": "200",
  "width": "200",
  "height": "200",
  "files": [
    {
      "name": "1600x900.png",
      "type": "image/png",
      "path": "testdata/images/1600x900.png"
    }
  ]
}

Output · HTTP 200

Result is a single file.
{
  "statusCode": 200,
  "headers": {
    "content-type": "image/png"
  }
}
Show curl command
curl -X POST 'https://api.1001fx.com/images/cropimage' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -F 'file=@1600x900.png' \
  -F 'x=200' \
  -F 'y=200' \
  -F 'width=200' \
  -F 'height=200'

Try cropimage now

Run it in your browser or create a free account and get 100 credits every month.

Changelog

  • 1.0.021.02.2023created
Ask 1001fx