Skip to content
Browse all functions

Scale an Image to Fit Given Dimensions

images/scaleimagetofit

scaleimagetofit (Scale an Image to Fit Given Dimensions) is a 1001fx API function in the group Images: POST https://api.1001fx.com/images/scaleimagetofit, 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

Scales an image to the largest size that will fit within a rectangle of the specified width and height.

Try it in the 1001fx app

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

scaleimagetofit in the 1001fx app: the form with example values
Scale an Image to Fit Given Dimensions in the 1001fx app

Endpoint

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

Parameters

  • widthnumberrequired

    The width to scale the image to.

    Min:
    1
    Max:
    10000
    Example:
    100
  • heightnumberrequired

    The height to scale the image to.

    Min:
    1
    Max:
    10000
    Example:
    100
  • filefilerequired

    Image file to be processed.

Examples

Image scale to fit 1200x1000

Scales an image to fit 1200x1000

Input

Expects one image file named as file parameter: file
{
  "width": "1200",
  "height": "1000",
  "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/scaleimagetofit' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -F 'file=@1600x900.png' \
  -F 'width=1200' \
  -F 'height=1000'

Use cases

Try scaleimagetofit now

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

Changelog

  • 1.0.010.02.2023created
Ask 1001fx