Skip to content

Collage / Grid

Combine multiple images into beautiful grid collages with 25+ templates. Supports 2-9 image layouts with customizable gap, corner radius, background color, and per-cell pan/zoom controls.

API Endpoint

POST /api/v1/tools/collage

Parameters

ParameterTypeRequiredDefaultDescription
templateIdstringYes-Template layout ID (e.g. 2-h-equal, 3-left-large, 4-grid, 9-grid)
cellsarrayNo-Per-cell settings array with imageIndex, panX, panY, zoom, objectFit
cells[].imageIndexintegerYes-Index of the image to place in this cell (0-based)
cells[].panXnumberNo0Horizontal pan offset (-100 to 100)
cells[].panYnumberNo0Vertical pan offset (-100 to 100)
cells[].zoomnumberNo1Zoom level (1 to 10)
cells[].objectFitstringNo"cover"How image fills cell: cover or contain
gapnumberNo8Gap between cells in pixels (0 to 500)
cornerRadiusnumberNo0Corner radius for each cell in pixels (0 to 500)
backgroundColorstringNo"#FFFFFF"Background color as hex or "transparent"
aspectRatiostringNo"free"Canvas aspect ratio: free, 1:1, 4:3, 3:2, 16:9, 9:16, 4:5
outputFormatstringNo"png"Output format: png, jpeg, webp, avif, jxl
qualitynumberNo90Output quality (1 to 100)

Available Templates

Template IDImagesLayout
2-h-equal2Two equal columns
2-v-equal2Two equal rows
2-h-left-large2Left 2/3, right 1/3
2-h-right-large2Left 1/3, right 2/3
3-left-large3Large left, two stacked right
3-right-large3Two stacked left, large right
3-top-large3Large top, two columns bottom
3-h-equal3Three equal columns
3-v-equal3Three equal rows
4-grid42x2 grid
4-left-large4Large left, three stacked right
4-top-large4Large top, three columns bottom
4-bottom-large4Three columns top, large bottom
5-top2-bottom35Two top, three bottom
5-top3-bottom25Three top, two bottom
5-left-large5Large left, four stacked right
5-center-large5Large center, four corners
6-grid-2x362 columns x 3 rows
6-grid-3x263 columns x 2 rows
6-top-large6Large top, five columns bottom
7-mosaic7Mosaic layout
8-mosaic8Mosaic layout
9-grid93x3 grid

Example Request

bash
curl -X POST http://localhost:13490/api/v1/tools/collage \
  -F "[email protected]" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F 'settings={"templateId":"4-grid","gap":12,"cornerRadius":8,"backgroundColor":"#F5F5F5","outputFormat":"png","quality":90}'

Example Response

json
{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/collage.png",
  "originalSize": 2456789,
  "processedSize": 1823456
}

Notes

  • Upload multiple image files in the multipart request. The images are assigned to template cells in upload order.
  • If more images are uploaded than the template supports, extra images are ignored.
  • Supports HEIC, RAW, PSD, and SVG input formats (automatically decoded).
  • The canvas base size is 2400px on the longest side, scaled by the chosen aspect ratio.
  • When aspectRatio is "free", the canvas defaults to 4:3 (2400x1800).
  • Per-cell panX/panY values shift the crop window within the cell. A value of 100 moves fully to one edge, -100 to the other.
  • The "transparent" background color is only preserved with png, webp, or avif output formats.