Allscreenshots Docs
API reference

Compose

Combine multiple screenshots into a single image

Screenshot composition

Combine multiple screenshots into a single image with automatic layout, labels, and styling. Perfect for comparison images, galleries, and social media content.

Endpoint

POST /v1/screenshots/compose

Modes

The compose API supports two modes:

Captures mode

Capture multiple different URLs:

{
  "captures": [
    { "url": "https://site1.com", "label": "Site 1" },
    { "url": "https://site2.com", "label": "Site 2" },
    { "url": "https://site3.com", "label": "Site 3" }
  ],
  "output": {
    "layout": "grid"
  }
}

Variants mode

Capture one URL with different configurations:

{
  "url": "https://example.com",
  "variants": [
    { "device": "desktop_hd", "label": "Desktop" },
    { "device": "iphone_15", "label": "iPhone" },
    { "device": "ipad_pro_11", "label": "iPad" }
  ],
  "output": {
    "layout": "horizontal"
  }
}

Layout types

LayoutDescription
autoAutomatically selects the best layout based on image count and dimensions
gridEqual-sized cells in rows and columns
horizontalSingle row, all images side by side
verticalSingle column, all images stacked
masonryPinterest-style staggered layout
mondrianAbstract art-inspired geometric blocks
partitioningBalanced rows like Google Photos/Telegram

Request body

Captures mode

{
  "captures": [
    {
      "url": "https://example.com",
      "id": "capture-1",
      "label": "Example Site",
      "viewport": { "width": 1280, "height": 720 },
      "device": null,
      "fullPage": false,
      "darkMode": false,
      "delay": 0
    }
  ],
  "defaults": {
    "viewport": { "width": 1920, "height": 1080 },
    "format": "png",
    "quality": 80,
    "fullPage": false,
    "delay": 0,
    "waitFor": null,
    "waitUntil": "load",
    "timeout": 30000,
    "darkMode": false,
    "customCss": null,
    "hideSelectors": [],
    "blockAds": false,
    "blockCookieBanners": false,
    "blockLevel": "none"
  },
  "output": { ... },
  "async": false,
  "webhookUrl": null,
  "webhookSecret": null
}

Output options

{
  "output": {
    "layout": "grid",
    "format": "png",
    "quality": 90,
    "columns": 2,
    "spacing": 10,
    "padding": 20,
    "background": "#ffffff",
    "alignment": "center",
    "maxWidth": 2000,
    "maxHeight": 2000,
    "thumbnailWidth": null,
    "labels": {
      "show": true,
      "position": "bottom",
      "fontSize": 14,
      "fontColor": "#333333",
      "background": "#ffffff",
      "padding": 8
    },
    "border": {
      "width": 1,
      "color": "#cccccc",
      "radius": 8
    },
    "shadow": {
      "enabled": true,
      "blur": 10,
      "offsetX": 0,
      "offsetY": 4,
      "color": "rgba(0,0,0,0.2)"
    }
  }
}

Output parameters

ParameterTypeDefaultDescription
layoutstring"auto"Layout algorithm
formatstring"png"Output format: png, jpeg, webp
qualityinteger90Image quality (1-100)
columnsintegerautoFixed number of columns (grid layout)
spacinginteger10Space between images (0-100px)
paddinginteger0Padding around edges (0-100px)
backgroundstring"#ffffff"Background color or "transparent"
alignmentstring"center"Vertical alignment: top, center, bottom
maxWidthinteger-Maximum output width (100-10000)
maxHeightinteger-Maximum output height (100-10000)
thumbnailWidthinteger-Resize captures to this width (50-2000)

Label options

ParameterTypeDefaultDescription
showbooleantrueShow labels
positionstring"bottom"Position: top or bottom
fontSizeinteger14Font size (8-48)
fontColorstring"#333333"Text color
backgroundstring"#ffffff"Label background
paddinginteger8Label padding (0-20)

Border options

ParameterTypeDefaultDescription
widthinteger1Border width (0-10)
colorstring"#cccccc"Border color
radiusinteger0Corner radius (0-20)

Shadow options

ParameterTypeDefaultDescription
enabledbooleantrueShow shadow
blurinteger10Shadow blur (0-50)
offsetXinteger0Horizontal offset (-20 to 20)
offsetYinteger4Vertical offset (-20 to 20)
colorstring"rgba(0,0,0,0.2)"Shadow color

Examples

Side-by-side comparison

curl -X POST 'https://api.allscreenshots.com/v1/screenshots/compose' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "captures": [
      { "url": "https://old-design.example.com", "label": "Before" },
      { "url": "https://new-design.example.com", "label": "After" }
    ],
    "output": {
      "layout": "horizontal",
      "spacing": 20,
      "padding": 20,
      "background": "#f5f5f5"
    }
  }' --output comparison.png

Responsive showcase

curl -X POST 'https://api.allscreenshots.com/v1/screenshots/compose' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://example.com",
    "variants": [
      { "device": "desktop_hd", "label": "Desktop" },
      { "device": "laptop", "label": "Laptop" },
      { "device": "ipad_pro_11", "label": "Tablet" },
      { "device": "iphone_15", "label": "Mobile" }
    ],
    "output": {
      "layout": "grid",
      "columns": 2,
      "spacing": 15,
      "border": { "width": 1, "color": "#e0e0e0", "radius": 8 },
      "shadow": { "enabled": true }
    }
  }' --output responsive.png
curl -X POST 'https://api.allscreenshots.com/v1/screenshots/compose' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "captures": [
      { "url": "https://unsplash.com/photos/abc" },
      { "url": "https://unsplash.com/photos/def" },
      { "url": "https://unsplash.com/photos/ghi" },
      { "url": "https://unsplash.com/photos/jkl" },
      { "url": "https://unsplash.com/photos/mno" }
    ],
    "output": {
      "layout": "partitioning",
      "spacing": 4,
      "maxWidth": 1200
    }
  }' --output gallery.png

Dark vs light mode

curl -X POST 'https://api.allscreenshots.com/v1/screenshots/compose' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://example.com",
    "variants": [
      { "darkMode": false, "label": "Light Mode" },
      { "darkMode": true, "label": "Dark Mode" }
    ],
    "output": {
      "layout": "horizontal",
      "background": "#1a1a1a",
      "labels": {
        "fontColor": "#ffffff",
        "background": "transparent"
      }
    }
  }' --output themes.png

Compositions count as one screenshot per captured URL. A composition of 4 URLs uses 4 screenshots from your quota.

Async composition

For large compositions, use async mode:

{
  "captures": [ ... ],
  "async": true,
  "webhookUrl": "https://your-server.com/webhooks/compose"
}

Returns a job ID that you can poll or receive via webhook when complete.

On this page