How to Inpaint in Stable Diffusion A1111, A Detailed Guide with Inpainting Techniques to level up!

Keyboard Alchemist
27 Nov 202318:11

TLDRThis tutorial showcases various inpainting techniques in Stable Diffusion A1111, enabling users to add or modify elements within an image. It covers the installation of the Photopia extension for image editing and demonstrates how to inpaint a parrot on a shoulder and transform an arm into a cyborg arm. The guide also explains using LURAS (low rank adaptation) for specific part alterations, like adding a pirate hat or a robotic arm, and emphasizes the importance of denoising strength and sampling steps for optimal results. The video provides a comprehensive guide for users to enhance their image editing skills in Stable Diffusion A1111.


  • 🎨 Inpainting in Stable Diffusion allows you to add or modify elements within an image, such as placing a parrot on a shoulder or changing an arm to a cyborg arm.
  • 🔧 To get started with inpainting, download and install the Photopia extension, which is a photo editing tool integrated into the web UI.
  • 🖌️ Use the Photopia tools to select and cut out the element you want to inpaint, such as the parrot, and clean up jagged edges for a smoother transition.
  • 🦜 Send the image with the cut-out element to the inpainting interface and use a mask to cover the element, ensuring to leave padding on the edges for context.
  • 🔄 Experiment with different denoising strength values and random seeds to find the best result for inpainting the element into the image.
  • 🏴‍☠️ For adding a new element like a pirate hat, use the 'fill' option for the masked content setting and a higher denoising strength to materialize the object.
  • 🔍 Use the 'only masked' mode for inpainting to reference a smaller area around the mask, which can sometimes yield better results.
  • 🤖 For specific part modifications like turning an arm into a robotic arm, utilize LURAS (Low Rank Adaptation) for fine-tuning the Stable Diffusion model.
  • 📂 Organize your LURAS collection by adding a preview image and a short description to the LURA properties for easy identification and use.
  • 🛠️ Adjust the inpainting mask size and shape to refine the results and ensure a cohesive integration of the new element into the image.
  • 🌴 If the background needs fixing, use inpainting sketch to redraw missing elements and adjust prompts and settings accordingly for a seamless finish.
  • ✨ After achieving satisfactory results, perform a latent upscaling to fix minor imperfections and ensure consistency in the final image.

Q & A

  • What is the name of the extension mentioned for photo editing in the tutorial?

    -The extension mentioned for photo editing is called Photopia.

  • How is the Photopia extension installed in the tutorial?

    -To install Photopia, one needs to go to the extensions section, click on 'install from URL', paste the Photopia GitHub link provided in the video description, and then click 'install'. After installation, check for updates and restart the UI.

  • What is the purpose of using a negative prompt in the image regeneration process?

    -The purpose of using a negative prompt is to regenerate the image with the original settings but without including certain elements or aspects that are not desired in the final image.

  • What tool is used to select and cut out the parrot from its background in Photopia?

    -The magnet selection tool is used to select and cut out the parrot from its background in Photopia.

  • How does the AI model handle the inpainting process when a mask is applied?

    -The AI model generates a new image that is similar to the original and then merges the portion of the new image defined by the inpainting mask with the original image.

  • What is the significance of leaving padding around the mask when inpainting?

    -Leaving padding around the mask provides the AI model with context from the surrounding pixels, which helps in generating a more accurate and seamless inpainting result.

  • What is the role of the denoising strength setting during the inpainting process?

    -The denoising strength setting determines the level of changes made to the original image during inpainting. A lower value results in fewer changes, while a higher value allows for more significant alterations to integrate the inpainted elements.

  • How does the 'only masked' setting differ from the 'whole picture' setting in inpainting?

    -The 'only masked' setting makes the model reference only a portion of the area around the mask to generate new images, whereas the 'whole picture' setting uses the entire picture as a reference.

  • What is LURAs and how is it used in the context of the tutorial?

    -LURAs stands for Low-rank Adaptation, a training method to fine-tune a stable diffusion checkpoint. It is used to generate consistent styles, objects, characters, and in this case, robotic arms. The tutorial demonstrates how to use a LURA called 'real mechanical Parts LURA' to inpaint a robotic arm.

  • How can one organize their collection of LURAs for easier use?

    -One can organize their LURAs by adding a preview image to each LURA file. This is done by saving a representative image as a PNG with the same name as the LURA file but with a '.preview.png' extension in the LURA folder.

  • What is the purpose of latent upscaling in the image-to-image process?

    -Latent upscaling is used to fix minor imperfections in the image and ensure consistency, such as matching skin tones across different parts of the body.

  • How does the tutorial suggest dealing with unwanted elements in the background after inpainting?

    -The tutorial suggests creating a careful mask to cover all unwanted elements and then using inpainting with an appropriate prompt, such as 'white sandy beach', to replace the background with a clean version.



🎨 Introducing Image Inpainting Techniques

This paragraph introduces the concept of image inpainting, where the speaker, Keyboard Alchemist, discusses the creative possibilities of adding or altering elements within an image. The focus is on using inpainting to insert a parrot on a girl's shoulder and changing a girl's arm into a cyborg arm. The speaker emphasizes the importance of viewer engagement and plans to demonstrate these techniques using an extension called Photopia for image editing, which integrates with the web UI for a seamless experience.


🖌️ Implementing Parrot Inpainting with Photopia

The speaker provides a step-by-step guide on how to inpaint a parrot onto a shoulder using the Photopia extension. The process involves installing Photopia, importing the original image, and using negative prompts to regenerate the image with minimal changes. The speaker then explains how to cut out the parrot from its original background, clean up the edges, and use the inpainting interface to seamlessly integrate the parrot into the new image. The importance of denoising strength and the use of different settings for achieving the best result are also discussed.


🏴‍⚓️ Adding a Pirate Hat with Inpaint Sketch

In this paragraph, the speaker shifts focus to adding a pirate hat to the image using a different method. The process involves sending the image to the inpainting sketch, drawing the shape of the hat, and using specific settings to inpaint the hat into the image. The speaker explains the importance of the denoising strength and sampling steps for achieving a realistic result. The paragraph also touches on the use of the 'only masked' mode for inpainting, which focuses on a smaller area around the mask for more precise results.


🤖 Transforming an Arm into a Robotic Arm with LURAS

The speaker delves into the use of LURAS (Low Rank Adaptation) for fine-tuning the stable diffusion model to create a robotic arm. The process involves downloading a specific LURA, installing it, and using it within the web UI. The speaker provides detailed instructions on how to use the LURA, including setting up the prompt, mask, and parameters for the best inpainting results. The paragraph also discusses the importance of selecting the right seed and tweaking parameters to match the original image's posture and stance.

🌴 Refining the Background and Final Touches

The final paragraph focuses on refining the background and making final adjustments to the image. The speaker explains how to remove unwanted elements from the background using inpainting and how to restore parts of the image that were altered during the process. The use of inpaint sketch and different parameters to recreate the background and details like a palm tree are discussed. The speaker concludes by demonstrating how to upscale the final image for a polished result, encouraging viewers to apply the covered techniques in their own projects.




Inpainting is a technique used in image editing to fill in missing or unwanted parts of an image with content that blends seamlessly with the surrounding area. In the context of the video, inpainting is used to add elements such as a parrot on a girl's shoulder or to modify parts of the image like changing a girl's arm into a cyborg arm. The process involves using AI models and tools like Photopia to generate and modify the image content, creating a realistic and cohesive final image.

💡Stable Diffusion

Stable Diffusion is a type of AI model used for generating images based on textual prompts. It is a deep learning technique that allows for the creation of detailed and varied visual content. In the video, Stable Diffusion is the underlying technology that enables the inpainting process, allowing the user to create and modify images by adding or changing elements within the scene, such as inserting a parrot or a cyborg arm into an existing image.


Photopia is a photo editing extension mentioned in the video that works within the web UI, providing tools similar to Photoshop for image manipulation. It is used for tasks such as selecting and cutting out elements from an image, like removing the background of a parrot image to prepare it for inpainting onto another image. Photopia facilitates the process by allowing easy transfer of images between the Stable Diffusion interface and the editing tool.


In the context of the video, masks are used in the inpainting process to cover or reveal certain parts of an image. They are essential for defining the area that needs to be inpainted or modified. For instance, a mask is used to cover the area where the parrot is to be added, ensuring that only that section is affected by the AI's inpainting. Masks help in maintaining the original context of the image while integrating new elements.

💡Denoiising Strength

Denoiising strength is a parameter in the Stable Diffusion model that controls the level of change from the original image during the inpainting process. A lower value means fewer changes and a higher value leads to more significant alterations. In the video, the creator adjusts the denoising strength to find the optimal balance between integrating new elements like the parrot and maintaining the original image's integrity. The correct denoising strength helps in achieving a realistic and seamless integration of the new content.

💡Random Seeds

Random seeds in the context of the video refer to the initial values used by the AI model to generate a batch of images. Each seed produces a different set of outcomes, allowing the user to choose the most suitable result for further refinement. In the inpainting process, the video creator uses random seeds to generate multiple versions of the image with the parrot, selecting the one that best fits the desired direction and appearance.

💡XYZ Plot Script

The XYZ plot script mentioned in the video is a tool used to visualize the relationship between different parameters of the inpainting process, such as denoising strength and sampling steps. This script helps the user to understand how varying these parameters affects the final output, enabling them to make informed decisions about the best settings to use for achieving the desired inpainting results.

💡Latent Upscaling

Latent upscaling is a technique used to enhance the quality and resolution of an image by adjusting its latent representation in the AI model. In the video, the creator uses latent upscaling to fix minor imperfections introduced by the inpainting steps, ensuring that the skin tone of the body matches the face. This process helps in creating a more cohesive and polished final image.


Luras, short for Low Rank Adaptations, are smaller training models used to fine-tune the output of a larger AI model like Stable Diffusion. They are ideal for generating consistent styles, objects, or characters, such as the robotic arm in the video. Luras can be trained relatively quickly and are used to impaint specific parts of an image with targeted content, ensuring that the new elements blend well with the existing image.

💡Real Mech Laura

Real Mech Laura is a specific Lura used in the video to create a robotic arm for the image inpainting. It is a trained model that generates mechanical parts and can be incorporated into the main AI model to produce consistent and detailed robotic elements. The Real Mech Laura is used to impaint the girl's arm with a realistic robotic arm, demonstrating the versatility and precision of Luras in image editing.

💡Inpaint Sketch

Inpaint Sketch is a feature within the Stable Diffusion interface that allows users to draw a rough sketch of the desired element or modification directly onto the image. In the video, the creator uses Inpaint Sketch to outline the shape of a pirate hat and the tree trunk, which the AI then uses as a guide to generate the final detailed image. This tool provides a more interactive and intuitive way to direct the inpainting process.


Inpainting in Stable Diffusion A1111 allows for creative image editing, such as adding a parrot on a girl's shoulder or changing a girl's arm into a cyborg arm.

Photopolia, a photo editing extension, can be used for seamless image editing within the web UI.

To install Photopia, visit extensions, click install from URL, and paste the GitHub link provided in the video description.

Use negative prompts to regenerate the image with minimal changes, setting denoising strength to 0.1.

The magnet selection tool in Photopia can be used to select and cut out objects like a parrot from the background.

Inpainting interface can cover objects with a mask, providing context with surrounding pixels for a more natural edit.

Dream Shaper 7 model is used for generating the parrot with MAA parrot in the positive prompt.

Default inpaint settings are used with attention to masked content and inpaint area settings for accurate results.

Batch generation with random seeds can help find the best image result for inpainting.

XYZ plot script can test various denoising strength values to determine the best one for the image.

Choosing an appropriate denoising strength value is crucial for a natural-looking inpaint.

Inpaint area only masked setting can be used for more precise edits, referencing only the area around the mask.

Inpainting can introduce inconsistencies like different skin tones, which can be fixed with latent upscaling.

Luras (low rank adaptation) can be used to inpaint specific parts of an image with consistent styles, like a robotic arm.

Real Mechanical Parts Lura from Civit AI can generate consistent robotic arm styles.

Adding a keyword to a Lura for easy use in prompts without having to remember to include it each time.

Organizing Luras with a preview image can help manage a collection and provide visual reference.

Inpainting a robot arm involves setting masked content to fill, using the whole picture as the inpaint area, and adjusting denoising strength.

Background elements can be removed or added back using careful masking and inpaint sketching techniques.

Final image refinement can be done with latent upscaling to address minor imperfections and ensure consistency.