Extend existing images in a single specified direction, allowing for precise directional expansion of your content.

Endpoint

POST https://api.legnext.ai/api/v1/pan

Headers

HeaderTypeRequiredDescription
x-api-keystringYesYour API key

Request Body

ParameterTypeRequiredDescription
jobIdstringYesID of the original image generation task
imageNointegerYesImage number to extend (0/1/2/3)
directionintegerYesExtension direction (0-3)
scalefloatYesExtension scale ratio (1.1-3.0)
remixPromptstringNoText prompt for the extended area (1-8192 characters)
callbackstringNoCallback URL for task completion notifications

Direction Values

ValueDirection
0Down
1Right
2Up
3Left

Scale Parameter

The scale parameter defines the ratio of the new image area to the original in the extension direction:
  • Range: 1.1 to 3.0
  • Example: For a 1:1 aspect ratio image extending right by 13%:
    • scale = 1.13 means the final image will be 13% wider in the specified direction

Example Requests

Extend Right

curl -X POST "https://api.legnext.ai/api/v1/pan" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jobId": "5dd94ec3-7282-4f04-9445-59e850ef1822",
    "imageNo": 0,
    "direction": 1,
    "scale": 1.5,
    "remixPrompt": "a lake near the mountain",
    "callback": "https://webhook.site/c98cb890-fb92-439f-8d60-42c8a51eb52d"
  }'

Response

Returns a task object containing the task information.
{
    "job_id": "98761286-cdc7-4085-abfe-c9f149ff722b",
    "model": "midjourney",
    "task_type": "pan",
    "status": "completed",
    "config": {
        "service_mode": "public",
        "webhook_config": {
            "endpoint": "https://webhook.site/d0ca59bc-35a6-4a1e-b1b1-aea7faeb7f67",
            "secret": ""
        }
    },
    "input": null,
    "output": {
        "image_url": "",
        "image_urls": [
            "https://image.legnext.ai/20250922/01k5qp2gqrfef8761r8n9q9w0c_0_0.png?Expires=1761102268&Signature=iNZM9BV0OCS32GXCSYEruuCs7zU%3D",
            "https://image.legnext.ai/20250922/01k5qp2gqrfef8761r8n9q9w0c_0_1.png?Expires=1761102268&Signature=6X1d2iMRXXn1afdYEKrAHKRAZW0%3D",
            "https://image.legnext.ai/20250922/01k5qp2gqrfef8761r8n9q9w0c_0_2.png?Expires=1761102268&Signature=clTVka9lszWiHZckseM%2BFafgbmc%3D",
            "https://image.legnext.ai/20250922/01k5qp2gqrfef8761r8n9q9w0c_0_3.png?Expires=1761102268&Signature=dH98ACZ%2FxBkvpsOD9BjmJpE4WN4%3D"
        ]
    },
    "meta": {
        "created_at": "2025-09-22T03:04:27Z",
        "started_at": "2025-09-22T03:04:28Z",
        "ended_at": "2025-09-22T03:05:03Z",
        "usage": {
            "type": "point",
            "frozen": 00,
            "consume": 00
        }
    },
    "detail": null,
    "logs": [],
    "error": {
        "code": 0,
        "raw_message": "",
        "message": "",
        "detail": null
    }
}

Technical Notes

  • Extends in only one specified direction (unlike outpaint which extends in all directions)
  • Scale parameter determines extension ratio (1.1-3.0)
  • AI maintains visual continuity with the original image
  • Use descriptive prompts to guide the content of the extended area