Image Editing and Cropping

Place Image on CanvasAPI

Place a cut-out image (transparent background) onto a fixed-size canvas. The subject is scaled to fill up to a chosen % of the canvas (keeping proportions), centred by default — align it to any edge and nudge it with offsets. Use it to normalise cut-outs to a consistent size and position, e.g. before a generative/edit step or for a uniform catalog look.

Test in Dashboard View Docs ← All Tools

Three ways to use this tool

REST API

One POST request. Get the result back directly — as an image, video, or JSON depending on the tool.

terminal
curl -X POST https://apiai.me/api/workflow/place-image-on-canvas \
     -H "X-API-Key: YOUR_API_KEY" \
     -F "image=@input.jpg" \
     -F "background=#e8e8e8" \
     -F "canvas_height=960" \
     -F "canvas_width=1280" \
     -F "h_align=center" \
     -F "max_height=90" \
     -F "max_width=90" \
     -F "min_opacity=8" \
     -F "v_align=center" \
     -F "x_offset=0" \
     -F "y_offset=0"
     --output result.png

Dashboard Playground

Test this tool visually before writing any code. Upload an image, set parameters, and see the result live. When it looks right, copy the auto-generated curl command and paste it into your app.

  1. Open the dashboard → API Toolbox
  2. Find Place Image on Canvas and click it
  3. Upload your input and adjust parameters
  4. Copy the curl command and ship
Open Dashboard →

Batch Processing

Process hundreds of images at once without writing a loop. Upload a CSV with one row per item, set your parameters, and download the results as a ZIP when they're done.

  1. Open the dashboard → Batches
  2. Select Place Image on Canvas
  3. Add your content and start the batch
  4. Download results ZIP when complete
Go to Batches →

Parameters

Name Required Description Default / Options
background optional Fill behind the subject. Options: a hex colour like #e8e8e8, white, or transparent. #e8e8e8
canvas_height optional Output canvas height in pixels. 960
canvas_width optional Output canvas width in pixels. 1280
h_align optional Horizontal placement. Options: left, center, right. leftcenterright
max_height optional Subject is scaled to fill up to this % of the canvas height, keeping proportions (never stretched). The tighter of max_width/max_height sets the size. 90
max_width optional Subject is scaled to fill up to this % of the canvas width, keeping proportions (never stretched). The tighter of max_width/max_height sets the size. 90
min_opacity optional How solid a pixel must be (0-100%) to count as part of the subject; fainter see-through edge pixels are treated as background. 8
v_align optional Vertical placement. Options: top, center, bottom. topcenterbottom
x_offset optional Nudge left/right from that placement, as % of the canvas width. Positive = right, negative = left. 0
y_offset optional Nudge up/down from that placement, as % of the canvas height. Positive = down, negative = up. 0

Ready to integrate?

Get an API key, test Place Image on Canvas in the dashboard, and copy the curl command.

Get API Key Full API Reference