# Extend

Extend, also known as outpainting, lets you expand your image beyond its original edges. It can also modify existing parts of the image, similar to Magic Fill.

## How to Use Extend

{% hint style="info" %}
It is best to review the [Canvas](https://docs.ideogram.ai/canvas-and-editing/canvas/canvas-overview) page beforehand to gain a better understanding of its interface and various elements. This will help you more easily follow the steps in the examples shown below.
{% endhint %}

### Extending an Image

In the example below, the Extend function is used to generate a visual extension and add context that seamlessly blends around the main image.

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2F8ZEcu2wAnnflBzFn6Fvi%2FCookies%20-%20Original.png?alt=media&#x26;token=86fb4586-e5ee-439b-ab61-77cd8dfb9208" alt="" width="375"><figcaption><p>Original image.</p></figcaption></figure>

Here's how to do it:

1. Open or import the image in Canvas.
2. Click the Extend button on the left-side panel.
3. Reposition and resize the Extend generation window around the original image, leaving empty space around it where you want to add to the original image.

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FaDbTsCtTs2qib3OA1PJT%2FCookies%20-%20inpaint.jpeg?alt=media&#x26;token=e626255e-92c6-495a-bf8d-c5d75b092b3e" alt=""><figcaption><p>Placement of the original image within the frame and the empty space left around it.</p></figcaption></figure>

4. Write a detailed prompt containing all visual aspect of the final image you want.

Here's the prompt used: `A photo of a young boy holding a chocolate chip cookie beside a rustic kitchen table with a cookie jar full of cookies, a plate with two cookies and a glass of milk. He is wearing a white t-shirt and green overalls. The background is blurred, but it appears to be an indoor setting with a neutral color palette.`

5. Adjust any additional options, like Style and Magic Prompt, as desired.
6. Click Extend to generate the images.
7. Once the process is complete, you can cycle through the four generated images by selecting the generated image and clicking the left or right arrow in the menu at the bottom of the image.

<figure><picture><source srcset="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FXSiUWZKUwqsqiFR0EnIM%2FA%20young%20boy%20with%20short%20blond%20hair%20in%20a%20three-qua%E2%80%A6%20%E2%80%93%20Ideogram%20-%20Light%20Dark%402x.png?alt=media&#x26;token=f73ac85b-4130-45bc-9682-448320c236b4" media="(prefers-color-scheme: dark)"><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FE8MbRvl78zlu0z1EXNEh%2FA%20young%20boy%20with%20short%20blond%20hair%20in%20a%20three-qua%E2%80%A6%20%E2%80%93%20Ideogram%20-%20Light%20Dark%402x.png?alt=media&#x26;token=c4689450-31df-4493-9702-1b2d1e12ec53" alt="" width="278"></picture><figcaption><p>Image selection in the bottom menu.</p></figcaption></figure>

Here's one of the four images that was generated:

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FyDmENXylsy28YPePQDma%2FCookies%20-%20Final.png?alt=media&#x26;token=18dfbc99-8239-43ea-8448-2662ea6a0fc1" alt=""><figcaption><p>Final image.</p></figcaption></figure>

Here's another example. This time, an image was extended in a panorama style format:

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FHOnWuTTxz50rqgZY1apb%2FCerfs%201.png?alt=media&#x26;token=c299ab3e-d760-4a36-8786-9c290158eb8c" alt="" width="375"><figcaption><p>Original image.</p></figcaption></figure>

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FNOMuZuClvy6dk1QFNyK8%2FCerfs%20inpaint.jpeg?alt=media&#x26;token=c1c97c0d-49e3-4ba1-8ac9-c8f304e1f587" alt=""><figcaption><p>The generation window is resized horizontally into a banner-like format, with the image strategically placed for a well-balanced composition.</p></figcaption></figure>

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2Fu0KDnhQLtO2yhwfSOSGt%2FCerfs%202.png?alt=media&#x26;token=ec863890-5fa6-4d96-912a-747bd3dfa8ed" alt=""><figcaption><p>The final image.</p></figcaption></figure>

***

### Refining While Extending an Image

In this example, two modifications will be done at the same time:

* A man cutting vegetables will be added to the left side of the image.
* The glass of water will be changed into a cup of coffee.

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FIL3fqLAebEhH8eeHqiO1%2FIdeogram%20-%20Light%20Dark%402x.png?alt=media&#x26;token=1ad34626-69ef-47b2-b63d-7978e25abc95" alt="" width="375"><figcaption><p>The original image to be modified.</p></figcaption></figure>

Here's how to do it:

1. Click the Extend button on the left-side panel.
2. Reposition and resize the Extend generation window to your liking, trying to keep the generation window as small as possible while keeping visual context for the AI to work with.
3. Mask the glass of water with the [Masking Tools](https://docs.ideogram.ai/canvas-and-editing/canvas-overview#masking-options) to indicate it should be replaced in the generated image.

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2F503eWkehLRC8m2jW8fSx%2FIdeogram%20-%20Light%20Dark%402x.png?alt=media&#x26;token=7d80d533-e593-4150-bd32-cc5de7c07d96" alt=""><figcaption></figcaption></figure>

4. Enter a prompt that describes:
   1. The part overlapping the original image.
   2. What should be generated where the image will be extended.
   3. The changes to be made to the masked areas.

Prompt used: `A photo of a middle-aged woman with short hair holding a cup of hot coffee in a modern, white kitchen with wooden countertops. She is wearing a blue shirt and a necklace. A man is chopping vegetables on the counter beside her.`

<figure><picture><source srcset="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2F3PM6Wqf6ISiPWC7DC3bq%2FMadame%20Cafe%CC%81%20%E2%80%93%20Ideogram%20-%20Light%20Dark%402x.png?alt=media&#x26;token=606e130f-54cb-46d6-87ea-88f7c371b634" media="(prefers-color-scheme: dark)"><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FBk4sD7cd5zjIfnSLvlnp%2FMadame%20Cafe%CC%81%20%E2%80%93%20Ideogram%20-%20Light%20Dark%402x.png?alt=media&#x26;token=8e8d4f07-750d-4947-8545-fd45e3867e5c" alt=""></picture><figcaption></figcaption></figure>

5. Adjust any additional options as desired.
6. Click Extend to generate the images.
7. Select the image and use the arrows at the bottom to view all four generated options and choose the one you like.

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2F04EyqDaKOBTwXXLOSKiE%2FIdeogram%20-%20Light%20Dark%402x.png?alt=media&#x26;token=85d7e626-e3ec-45fb-a1af-f54bad0cce56" alt=""><figcaption><p>The resulting image after extending it on the left and changing a part of the original image.</p></figcaption></figure>

***

## Advanced and Creative Examples

The Extend tool can be used creatively to achieve impressive results. The examples below demonstrate how using the tool in creative ways can lead to surprising outcomes. For example, you can take an image of an object and create a whole environment around it.

{% hint style="warning" %}
The advanced techniques presented below sometimes push the tool to its limits. They are more about creative exploration and achieving good results can be challenging at times. Indeed, many factors influence the final rendering of the image like the prompt, the original image, the options used, etc.

Experimenting with prompts and different options is often essential, but even then, results may vary. If you encounter difficulties, you can ask for help in the [#prompt-w-friend](https://discord.com/channels/1106248220687994911/1145120589955223602) channel on our Discord server. Simply share your prompt, the generated image, and a brief description of the issue. Other users may be able to help you achieve better results.
{% endhint %}

### Generate Context Around an Object

In this example, a whole environment will be created around the image of a wine bottle.

Here's how to do it:

1. Upload or copy/paste your image in Canvas.
2. If possible, use the remove background tool to get a transparent background.
   1. Alternatively, you can mask out the areas around the object manually using the mask tools that will be available in the Extend tool after the next step.
3. Click the Extend tool on the left-side panel.
4. Reposition and resize the Extend generation window to your liking with the object inside the generation window.

<div><figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2Fsji5lf8mZo42mssSiKUE%2FWine%201%20Original.png?alt=media&#x26;token=df01cc76-dc98-4fe0-a9fb-8fa046ab7296" alt="" width="375"><figcaption><p>The original wine bottle image.</p></figcaption></figure> <figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FAvIk70AgubPT22y6dxGd%2FWine%202%20Inpaint.jpeg?alt=media&#x26;token=f6b21e3a-c207-483f-bb78-4ec4251296f7" alt="" width="375"><figcaption><p>Background removed and bottle placed in the generation window.</p></figcaption></figure></div>

5. Write a detailed prompt that describe the image to be generated in details. Prompt used: `A bottle of red wine labeled 'CASTLE CELLARS' is in a dimly lit room, featuring a wooden table and a candle. A glass of wine is near the bottle, and a cork is on the wooden surface. In the background, there are red and blue grapes. The label is embossed with intricate designs and the castle logo is prominently displayed in the center.`
6. Select the image and use the arrows at the bottom to view all four generated images and choose the one you like.

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2F8J8SXAKIMq7F2z4oL3ye%2FWine%203b%20Final.png?alt=media&#x26;token=830669b5-8ed5-4fe3-a4bc-39945e7b5bc1" alt="" width="375"><figcaption><p>The final image of the bottle integrated into the decor.</p></figcaption></figure>

### Same Subject in Another Image Style

In the example below, a woman in a photo will be transformed into a caricature.

Here's how:

1. Open, upload or copy/paste your image in Canvas.
   1. It might be a good idea to have a good description of that image. If a prompt or description isn't already available, use the Describe feature to get one provided by the AI. It will be used later.

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FjzGtAuOqZ7f1h7cnTNyf%2FTransfo%201%20Original.png?alt=media&#x26;token=f02a1f41-68ff-4d1d-bfd2-b1fda5dd7d16" alt="" width="375"><figcaption><p>Original image.</p></figcaption></figure>

2. Click Extend then resize an position the generation window in a way where the original image will be on one side and the other side will be about the same size as the original image.

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FWR9yS6WTiGwdXHwbRFMW%2FTransfo%202%20Generation%20Window.jpeg?alt=media&#x26;token=23bccd72-301b-4312-8034-4f291991bdc8" alt=""><figcaption><p>The generation window adjusted to overlap the original image and extend on the right side.</p></figcaption></figure>

3. Write a detailed prompt that describe both the original image and the image you want to generate.

Prompt used: `On the left, a woman with long, wavy, light brown hair and glasses. On the right, a hand drawn funny caricature portraying the same woman.`

Style used: General

4. Select the image and use the arrows at the bottom to view all four generated images and choose the one you like.

<figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FW4ACSEEPipZWcq7PlURY%2FTransfo%20Caricature.png?alt=media&#x26;token=58a0445e-1a00-494e-b70b-1af7a683dddf" alt="" width="375"><figcaption><p>Final image as caricature.</p></figcaption></figure>

Here are other examples that were generated with the same technique, simply by changing the last part of the prompt and using appropriate style options.

<div><figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FdBRLiob9bMVAjppEIC5j%2FTransfo%20Cartoon.png?alt=media&#x26;token=b8401b7d-dab3-41a6-9499-a4e80bea9fd5" alt=""><figcaption><p>... a cartoon character showing the same woman as if she was a schoolgirl. <strong>Style used: General</strong></p></figcaption></figure> <figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FwhfMsQfRJVj2OoUEn3O0%2FTransfo%20Chibi.png?alt=media&#x26;token=0585dc9d-0d4e-446f-b67e-15ff46ca74d1" alt=""><figcaption><p>... a 3D character depicting the same woman as a chibi character. <strong>Style used: 3D</strong></p></figcaption></figure></div>

<div><figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2Frl9WdbYVrwYX8emUAmXA%2FTransfo%20Coloring%20Book.png?alt=media&#x26;token=25c0f86e-7ff0-48ce-b3c5-d3718c8b4b8c" alt=""><figcaption><p>... a kid's coloring book page showing the same woman as if she was a mermaid. <strong>Style used: Realistic</strong></p></figcaption></figure> <figure><img src="https://1799634369-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzjhNby3LLsIikYuvxAJP%2Fuploads%2FJE44tGF7bsDJJ57B7i1e%2FTransfo%20Pop%20Art.png?alt=media&#x26;token=76ce7263-2a30-434b-9dde-d01ef6d4ceb3" alt=""><figcaption><p>... a pop art poster depicting the same woman as a pop art comic character. <strong>Style used: Design</strong></p></figcaption></figure></div>

***

## Tips and Tricks for Best Results

Achieving great results with **Magic Fill** and **Extend**, especially with advanced techniques, takes a mix of creativity, experimentation, and a bit of patience. Here are some key factors that can impact the final outcome:

* **Craft precise and detailed prompts** – Clarity in wording helps the AI understand what to generate.
* **Experiment with synonyms and rephrase** - Changing a few words or testing different ways of expressing the same idea in a prompt can make big difference.
* **Start with a high-quality image** – The better the input, the better the output.
* **Consider the complexity of the image** – Simpler modifications often yield more accurate results.
* **Optimize the generation window size** – Keeping it as small as possible while including enough context leads to sharper and more realistic outcomes.
* **Manage your expectations** – AI-generated results can vary, so refining your approach and testing different options is key to success.

By experimenting with different approaches, adjusting prompts, and fine-tuning generation settings, you can push the boundaries of what's possible and create stunning images.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ideogram.ai/canvas-and-editing/canvas/extend.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
