Skip to content
Browse all functions

Overlay an Image on another Image

images/overlayimages

overlayimages (Overlay an Image on another Image) is a 1001fx API function in the group Images: POST https://api.1001fx.com/images/overlayimages, 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

Overlays two images to create a new image with the second image placed as an overlay. Uses the png file format for transparency. Canvas size is preserved.

Use cases

  • Put your logo on product photos
  • Place a badge or a frame over profile pictures
  • Combine a background image and a transparent PNG into a social media image

Try it in the 1001fx app

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

overlayimages in the 1001fx app: the form with example values
Overlay an Image on another Image in the 1001fx app

Endpoint

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

Parameters

  • xnumberrequired

    The x position from top left corner. Defaults to 0.

    Default:
    0
    Example:
    100
  • ynumberrequired

    The y position from top left corner. Defaults to 0.

    Default:
    0
    Example:
    200
  • file1filerequired

    Image in the background. Use png to preserve transparency.

  • file2filerequired

    This image is placed on top of the background image. Transparency is allowed (png only).

Examples

Combine to images and place the second on top of the first

Combine two images to a new one

Input

Expects two images named as file parameter: files and x,y position
{
  "x": "100",
  "y": 100,
  "files": [
    {
      "name": "1600x900.png",
      "type": "image/png",
      "path": "testdata/images/1600x900.png"
    },
    {
      "name": "256x256.png",
      "type": "image/png",
      "path": "testdata/images/256x256.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/overlayimages' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -F 'file1=@1600x900.png' \
  -F 'file2=@256x256.png' \
  -F 'x=100' \
  -F 'y=100'

Frequently asked questions

How do I position the overlay?
With x and y in pixels from the top left corner of the background image. Both default to 0.
Is transparency kept?
Yes, if you use PNG files. The result is a PNG and keeps the canvas size of the background image.

Try overlayimages now

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

Changelog

  • 1.0.002.02.2023created
Ask 1001fx