Skip to content
Browse all functions

Mask an Image with Another Image

images/maskimage

maskimage (Mask an Image with Another Image) is a 1001fx API function in the group Images: POST https://api.1001fx.com/images/maskimage, 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

Masks a source image to this image using the average pixel color. A completely black pixel on the mask will make a pixel in the image completely transparent.

Try it in the 1001fx app

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

maskimage in the 1001fx app: the form with example values
Mask an Image with Another Image in the 1001fx app

Endpoint

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

Parameters

  • xnumberoptional

    The horizontal position from the top left corner. Defaults to 0.

    Default:
    0
    Example:
    100
  • ynumberoptional

    The vertical position from the top left corner. Defaults to 0.

    Default:
    0
    Example:
    200
  • file1filerequired

    Image to be masked.

  • file2filerequired

    Image to be used as mask.

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/maskimage' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -F 'file1=@1600x900.png' \
  -F 'file2=@256x256.png' \
  -F 'x=100' \
  -F 'y=100'

Try maskimage now

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

Changelog

  • 1.0.013.02.2023created
Ask 1001fx