Magic Fill
Last updated
Last updated
Magic Fill, also known as inpainting, allows you to modify a part of an image while keeping the rest intact.
Using Magic Fill is a simple two-step process:
Create a mask over the areas you want to modify.
Adjust the generation window and available options, then click Magic Fill.
Available tools and options for Magic Fill:
In the example below, the glass of water will be replaced by a glass of milk while a watch will be added to her left wrist.
Here’s how:
Click the Magic Fill button on the left-side panel.
Mask the hand holding the glass of water and the area where the watch should be placed.
Click Next to access the Magic Fill options at the top of the canvas.
Adjust the generation window to include both masked areas and some surrounding image content for context. In this case, the whole image area was used.
Enter a prompt describing the scene and the desired modifications. In this example:
A photo of a middle-aged woman with short hair holding a glass of milk in a modern, white kitchen with wooden countertops. She is wearing a blue shirt, a necklace and a watch...
Adjust additional options as desired.
Click Magic Fill to generate the images.
Select the image and use the arrows at the bottom to view all four generated options.
In the example below, an image of a rabbit was generated first in Ideogram as a starting image. Using Magic Fill, a basket of carrots is added in the background, and a carrot is placed in front of the rabbit.
Original prompt: Photo of a rabbit in a beautiful garden.
Magic Fill prompt: Photo of a rabbit in a beautiful garden. There is a basket with carrots in the background and a big carrot in front of the rabbit.
Magic Fill can also be used to create variations of specific details while keeping other elements unchanged
For example, a woman’s hair color can be altered without modifying her face or the rest of the image.
The prompt used to generate the original image was modified each time in Magic Fill to request a different hair color.
Original prompt: A close-up three-quarter shot of a young woman with a sharp,
platinum blonde
pixie cut. She has icy blue eyes and a hit of a playful smirk. She has metallic earrings on her ears. The background is blurred and hints at a sleek, futuristic setting. She gazes directly at the camera with confidence.
Magic Fill is great for refining AI-generated images where small details like faces and hands may appear distorted due to the limited number of pixels.
Here’s how to easily fix those issues using Magic Fill.
Below is an image generated with Ideogram v2.0 using a 1:1 aspect ratio (1024 × 1024 pixels). The original prompt was: A dynamic photo of a family standing on the lawn in front of a well-maintained house. The sky is clear with scattered clouds. Overlaying the top of the image, there's a text that reads 'Welcome' in a curvy font. The family consists of four members in that order: a young boy, a father, a mother and a teenager girl. The house in the background has a classic design with a gabled roof.
Notice how the faces and hands appear very small in relation to the whole image. Because of this, the AI had difficulty rendering them correctly.
To fix this:
Mask the areas that need correction.
Adjust the generation window to be as small as possible, covering all masked areas while keeping some unmasked visual references to help the AI understand the context.
Because the aspect ratio dictates the dimensions (in pixels) of the generated image, it can be leveraged to improve pixel density in specific areas. This technique is particularly useful for fixing small details that were not properly rendered in the original image.
In the example below, the generation window boundaries has a custom aspect ratio of 17:14, thus a dimension of 1088 × 986 pixels. The AI will have more pixels to work with for generating the faces and hands in masked areas.
The prompt was also simplified to reflect only the content within the generation window: A dynamic photo of a family standing on the lawn in front of a well-maintained house. The family consists of four members in that order: a young boy, a father, a mother and a teenager girl.
The AI generated the updated image directly over the original, modifying only the masked parts while leaving the rest intact.
While the faces now look significantly better, there is still room for improvement—particularly for the father holding his son’s hand. To refine this further:
Mask that specific part of the image again.
Resize the generation window to be even smaller.
Ensure the young boy is included in the generation window to provide the AI with proper proportions and context.
This time, the generation window was set to a 1:1 aspect ratio, meaning the newly generated section had a resolution of 1024 × 1024 pixels.
The final image below was downloaded using the Download feature. While the downloaded image retained a 1024 × 1024 resolution, areas with a higher pixel density were downscaled but still preserved the improvements made.
For more details on resolution and pixel density in Canvas, refer to the last two sections of the Canvas documentation.
Getting even better results
To further enhance image quality, consider using the Upscale feature before attempting any fixes. This will provide the AI with up to twice as many pixels to work with for the same selected area.
Keep in mind:
• The generation window has a fixed number of pixels based on its aspect ratio.
• If you upscale a 1:1 image (e.g., from 1024 × 1024 to 2048 × 2048), then use Magic Fill at a 1:1 aspect ratio (which generates a 1024 × 1024 image), it’s best to keep the generation window under half the size—both horizontally and vertically—of the upscaled image for optimal results.
Magic Fill can be used creatively to achieve impressive results. The examples below demonstrate how pushing the limits of the tool can lead to surprising outcomes. For example, you can take an image of a product and seamlessly integrate it into another existing image.
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 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.
In the example below, there is a photo of a decorative pillow with a geometric pattern and an image of a loveseat with some pillows in a living room. The goal is to modify the loveseat pillows so they match the design of the patterned pillow.
Obtain a good description of both images.
These descriptions will later be merged and optimized into a single prompt.
If the image was generated directly in Ideogram, you can reuse the original prompt.
If not, it is strongly recommended to use the Describe feature to generate an accurate description.
Place the two images side by side and resize one if necessary.
Click Magic Fill and mask the pillows in the loveseat image.
Click Next and adjust the generation window to cover:
The entire pillow with the geometric pattern image.
The masked area and a sufficient portion of the loveseat image to provide proper context.
Merge and optimize the descriptions of both images:
Description of the patterned pillow: A decorative pillow with a geometric pattern. The primary color of the pillow is a soft and dark olive green, and the pattern consists of intertwined white lines forming intricate designs. The design appears symmetrical, with two mirrored patterns on either side of the pillow. The pillow is on a white background.
Prompt used to generate the loveseat image: A close-up view of a cozy loveseat, without any pillow, in a modern living room. There are a few soft and dark olive green accents.
Merged and optimized prompt: On the left
, a decorative pillow with a geometric pattern. The primary color of the pillow is a soft and dark olive green, and the pattern consists of intertwined white lines forming intricate designs. The design appears symmetrical, with two mirrored patterns on either side of the pillow.
On the right
, a close-up view of a cozy loveseat with two pillows like the one on the left.
Why optimize the prompt?
The revised prompt removes unnecessary details and focuses on the most relevant elements for the AI.
The pillow description is detailed since it is the main element being generated.
The background context remains slightly less detailed, as long as it provides enough visual reference.
Adjust other options such as Style and Magic Prompt (it is recommended not to use Magic Prompt, as it might alter your optimized prompt)
Click Magic Fill and wait for the generation to complete.
Once the image is generated, click on it to cycle through the four generated variations using the arrows at the bottom.
Download the final image:
Click the Download tool on the left-side panel.
Select the desired area to be included in the final image.
Click Download.
Below is a comparison of the image before and after the transformation.
It’s easy to overlay text on an image using the Text tool in Canvas, but seamlessly integrating text into the natural elements of an image can be more challenging.
In the example below, the goal is to make it look as if a message is handwritten in the sand on a beach.
Once a beach image is selected, the Text tool is used to choose a suitable font and position the text where it should appear in the final image.
At this point, the text itself cannot be used directly to create the writing effect in the sand. Instead, follow these steps before proceeding to Magic Fill:
Move the text aside and make it completely black.
Use Remix on the text, setting the image weight to 100. This is necessary because a text box cannot be used directly in this technique—it must first be converted into an image.
Place the newly created image near the beach image.
Now, apply the same technique used in the first example:
Mask the area where the text should appear in the beach image.
Adjust the Magic Fill generation window to include both the masked area and the black text image, ensuring the AI understands the reference.
Here's the prompt that was used:
On the left
, a text saying "Time for a little vacation?".
On the right
, the same text in the same style, roughly written by hand in the sand of an undisturbed sandy beach with seashells and other objects.
Important notes
The final image may appear more blurry or pixelated compared to the original. This happens because the Magic Fill-generated section is often about twice the size of the original image.
Why does this happen?
The total number of pixels remains constant for any aspect ratio, regardless of the generation window size on the canvas. This is a current limitation of this technique.
However, to achieve the best possible results, consider the following:
Minimize the generation window
Keep it as small as possible while maintaining enough visual context for the AI.
Reduce the size of the reference text or object
The AI can work with a smaller image as long as the prompt description is detailed enough.
Reducing the reference image by half often works just as well while helping shrink the generation window.
Use the Upscale feature on the final image
Upscale makes the image larger and sharper.
Don’t forget to provide a detailed prompt when using Upscale for the best results.
Here’s another example where text was integrated as embroidery on a baseball cap using the same technique.
Here's the prompt that was used: On the right
, the word "Baseball" written in a bold script font.
On the left
, the same word and font style than the one on the right but embroidered in red on the front of a baseball cap.
Finally, using the same technique, it’s easy to integrate a logo onto an object.
Here's the prompt used for the example above: On the left
, logo for a brand of beer named "Iron Helm". At the center of the logo is a detailed illustration of a knight's helmet, which appears to be made of metal with rivets and a nose guard. The helmet is depicted in a frontal view. The logo is enclosed within a shield-like emblem, which is predominantly dark red and white.
On the right
, the exact same logo on a glass of beer.
In this example, a perfume bottle from a photo will be integrated into two different scenes:
A studio photography setup.
An image where a woman holds the bottle.
The original image of the perfume bottle was generated in Ideogram, but any image could be used. There is no need to remove the background, as long as the image isn’t cluttered with other objects.
Using the same technique as described in the previous examples:
An area was masked where the bottle should be integrated.
A part of a plate was also masked, allowing the AI to transform it into a more suitable pedestal, which it successfully did.
The perfume bottle image was placed on the left side of the studio setup image, and the generation window was made as small as possible while keeping some context.
Prompt used: To the left
, a perfume bottle for women named 'Azure' stands out prominently. The bottle has a gem-like, faceted design, predominantly blue with a silver cap and a black neck. The word 'AZURE' is prominently displayed on both the bottle and the neck.
On the right
, a close-up view of the same bottle is captured, placed atop a short white pedestal in a studio photography setup.
For the next integration, an image of a woman holding a perfume bottle was generated in Ideogram. The goal was to create a suitable scene for integration.
As before:
The perfume bottle image was placed to the left of the woman’s image.
The affected areas (her hands and the existing bottle) were masked.
The generation window was made as small as possible while keeping enough context for the AI, including part of the face and the base of the hands.
Prompt used: On the left
, a woman’s perfume bottle named 'Azure' features a unique, faceted design. The bottle is predominantly blue, with a silver cap and a black neck. The word 'AZURE' is prominently displayed on both the bottle and the neck.
On the right
, a chic woman holds the very same bottle of perfume.
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.