Plus plan

Expand Canvas

Make a picture bigger by adding new scenery around its edges
POST
/v1/ai/generation/expand

About this tool

This tool makes the canvas of your picture larger and invents matching scenery in the new space, like zooming out. Your original picture stays exactly as it was. You choose how much to add above, below, left and right, or pick a final shape such as wide. It uses AI (a computer program that creates images), so the new parts are made up and can vary.
For example, you have a square photo of a lake and you want a wide banner for a website, so the tool adds more sky and water on both sides.

How to use it

  1. Choose this tool.
  2. Add one picture with Upload, or drag and drop it.
  3. Type how much to add above, below, left and right, or choose a shape under Or grow to this shape.
  4. Optionally describe what should appear in the new area.
  5. Press Generate, then download the result.

What you get back

You get a larger picture with the original in the middle and new scenery around it. You can download it or make more versions to choose from.
TEST IT LIVE

Try Expand Canvas in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
AI
Plan
Plus
Method
POST
Endpoint
/v1/ai/generation/expand
Tool ID
ai.generation.expand
Authentication
API key
Accepts
Text and settings
Background jobs
Yes
Usage group
Ai
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/ai/generation/expand" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'files=@document.pdf' \
  -F 'on_unsupported=error' \
  -F 'top=0' \
  -F 'right=0'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.ai.generation.expand({
    "files": 'document.pdf',
    "on_unsupported": "error",
    "top": 0,
    "right": 0
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->ai()->generation()->expand([
    'files' => 'document.pdf',
    'on_unsupported' => 'error',
    'top' => 0,
    'right' => 0,
]);
echo $result->requestId;
FAQ

Frequently asked questions

Extend an image; the original pixels are restored exactly after generation. Readiness: unbenchmarked (see GET /v1/ai/capabilities/generation.expand).

Classification: ai. Deterministic stages: upload content sniffing, input image normalisation (Sharp), generated image validation and re-encoding (Sharp), signed-URL output, canvas extension (Sharp), original-region restoration.

Expand Canvas works from text and settings, so no file is needed. Every input is optional.

Not on the Free plan: Expand Canvas is available on the Plus plan and above. Free accounts can upgrade any time to use it. Each run uses credits from your monthly allowance.

Send a POST request to /v1/ai/generation/expand with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.