Remove and Combine Backgrounds with AI

Olivio Sarikas
2 Apr 202409:13

TLDRThis tutorial demonstrates how to remove backgrounds using AI in two platforms, Automatic 1111 and Comfy. It covers installing the Stable Diffusion Web UI extension in Automatic 1111, using different background removal methods, and adjusting settings for optimal results. The video also highlights the power of Comfy for more advanced image processing, including rendering characters and backgrounds separately and combining them with various techniques to achieve a seamless integration.

Takeaways

  • 😀 The video demonstrates how to remove backgrounds using AI in two different platforms: Automatic 1111 and Comfy.
  • 🔍 In Automatic 1111, a specific extension called 'stable diffusion web UI RMG' is used for background removal.
  • 🛠️ The extension in Automatic 1111 doesn't work directly in the text-to-image tab; images must be created first and then processed.
  • 🎨 Multiple background removal methods are available, such as U-Net, P-UUNet, and HUNet, with the latter being useful for separating clothing items.
  • 👗 For optimal results, avoid clothing that overlaps with the background to prevent incomplete clothing removal.
  • 🔍 After generating the image, it's important to inspect the edges and small gaps to ensure the removal is satisfactory.
  • 🔧 Adjustments can be made using 'alpha matting' to fine-tune the foreground and background thresholds for better results.
  • 🌈 Using a gray studio background is recommended as it doesn't interfere with colors in the image and avoids color spill during background removal.
  • 💻 Comfy is more powerful than Automatic 1111 and allows for more complex image processing and background combination.
  • 🖼️ The video provides a workflow in Comfy that involves rendering the character separately from the background to prevent color spill.
  • 🎨 Three different methods for background removal in Comfy are showcased, including creating a mask, direct background removal, and a simplified method using a composite note.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is demonstrating how to remove backgrounds from images using AI in two different platforms: Automatic 1111 and Comfy.

  • Who are the additional resources available for in the video?

    -The additional resources and workflows are available for the Patreon supporters of the video creator.

  • What is the name of the extension used for background removal in Automatic 1111?

    -The extension used for background removal in Automatic 1111 is called 'stable diffusion web UI RMG'.

  • How does the background removal process work in Automatic 1111?

    -In Automatic 1111, you first create the image, then send it to 'extras', where you can select 'remove background' and generate the image with the background removed as a PNG file.

  • What are some of the methods for background removal mentioned in the video?

    -Some of the methods mentioned for background removal include Uet U net, Uunet, and Human sack. Cloth sack is also mentioned, which separates different clothing items into different parts of the image.

  • Why is a gray studio background recommended for character images?

    -A gray studio background is recommended because it doesn't interfere with the colors in the image and doesn't leave color impressions around the hair when the background is removed.

  • What is the benefit of using Comfy over Automatic 1111 for background removal?

    -Comfy is more powerful than Automatic 1111 because it offers more choices and allows for better control over the background removal process, including the ability to adjust the foreground and background thresholds and erode size.

  • What are the limitations of the background removal method shown in the video?

    -The method shown has limitations such as not changing the perspective of the room or the person, and not altering light colors on the person to match the background lighting.

  • How can the final image be improved in Comfy?

    -The final image can be improved by combining the character and background images using various notes and adjusting the prompt to create a more cohesive result.

  • What does the video suggest for checking the quality of background removal?

    -The video suggests checking the edges, small gaps, and areas like between the arms or hands and the background to ensure the removal has worked well.

  • What is the role of 'D noise' in the final rendering process?

    -D noise is used in the final rendering process to slightly change the image and help it blend better with the background without the need for a strong noise level.

Outlines

00:00

🎨 Background Removal in AI Art Software

The script introduces a tutorial on how to remove backgrounds from images using the AI-powered software 'Automatic 1111' and 'Comfy'. It highlights the use of the 'Stable Diffusion Web UI' extension in 'Automatic 1111' for background removal, explaining the process of installing and applying the extension. The tutorial also covers the selection of different background removal methods such as 'U-Net', 'P-UUNet', and 'Human-Sack', with a focus on the importance of clothing not overlapping in the image for accurate results. It advises on checking the quality of the removal, adjusting alpha matting values for foreground and background thresholds, and using an 'erode size' setting to refine detail levels. The benefits of using a gray studio background to avoid color interference during background removal are also discussed. The tutorial then transitions to 'Comfy', where a more powerful workflow is introduced, starting with rendering a character against a gray background to prevent color spilling.

05:01

🖼️ Advanced Background Removal Techniques in Comfy

This paragraph delves into advanced background removal techniques available in 'Comfy', starting with the separation of character and background to avoid color spilling, which is crucial for combining clothing colors with any background colors. The script outlines three different methods for background removal: using a 'Layer Style' pack to create a mask, a 'Vas Not' pack for actual background removal resulting in a PNG with a removed background, and a 'Mixlab Pack' that simplifies the process by offering different methods without the need for settings adjustment. The paragraph also discusses the limitations of these methods, such as not changing the perspective or light colors on the person, and suggests further refinements like overlaying with an ambient light layer for more complex results. The tutorial concludes with a demonstration of combining images and rendering them with a 'D noise' level to blend the character with the background, resulting in a more cohesive final image.

Mindmap

Keywords

💡Background Removal

Background removal refers to the process of eliminating the backdrop of an image, leaving only the subject. In the context of the video, it is achieved through AI technology, specifically using the 'stable diffusion web UI RMG' extension within the automatic 1111 platform. This technique is crucial for creating images with a transparent background, which can then be combined with other elements or backgrounds.

💡AI (Artificial Intelligence)

AI is the simulation of human intelligence in machines that are programmed to think like humans and mimic their actions. In the video, AI is utilized to perform the task of background removal efficiently. The script mentions that the process is 'extremely powerful' and showcases how it can be applied in different software to achieve high-quality results.

💡Automatic 1111

Automatic 1111 is a platform mentioned in the script that supports extensions for image processing. The video demonstrates how to use an extension called 'stable diffusion web UI RMG' on this platform to perform background removal. It is one of the tools used to achieve the main theme of the video, which is to remove and combine backgrounds with AI.

💡Extensions

In the context of the video, extensions are additional features or tools that can be integrated into a software platform to enhance its capabilities. The 'stable diffusion web UI RMG' is an example of an extension used for background removal in automatic 1111. Extensions allow users to perform more complex tasks, such as AI-powered image editing.

💡Stable Diffusion Web UI RMG

Stable Diffusion Web UI RMG is the specific extension used in the video for background removal within the automatic 1111 platform. It is highlighted as a key tool for the AI-driven process of removing image backgrounds, allowing for the creation of images with transparent backgrounds that can be used in various applications.

💡Foreground and Background

Foreground refers to the main subject or elements in the front of an image, while the background is the area behind the subject. The video's main theme revolves around separating these two components using AI, particularly focusing on removing the background to leave the foreground subject with a transparent backdrop.

💡PNG

PNG stands for Portable Network Graphics, which is a type of image file format known for its ability to support transparency. In the video, the AI-generated images with removed backgrounds are saved as PNG files, allowing the foreground to be transparent and easily layered onto other backgrounds.

💡Threshold

In the context of image editing, a threshold is a value that determines the cutoff between different regions of an image, such as separating the foreground from the background. The script mentions adjusting 'foreground threshold and background threshold' values in the alpha matting process to refine the results of background removal.

💡Erosion

Erosion is a technique in image processing that reduces the detail level of an image, often used to remove small white noise or fine details. In the video, the 'erode size' setting is mentioned as a way to adjust the detail level during the background removal process, affecting how fine or rough the details appear in the final image.

💡Gray Studio Background

A gray studio background is a neutral-colored backdrop commonly used in photography and videography. The video script explains the benefits of using a gray background for AI background removal, as it does not interfere with the colors of the subject and prevents color spill when the background is removed.

💡Comfy

Comfy, in the context of the video, seems to be a platform or software where more advanced image processing can be done compared to automatic 1111. It is mentioned as being 'a lot more powerful' and is used to demonstrate more complex workflows for combining backgrounds and foregrounds in a more refined manner.

💡Mask

A mask in image editing is a selection that isolates part of an image from the rest. The video script discusses the use of masks in the context of AI background removal, where a 'layer mask generation' is created to separate the subject from the background, allowing for more precise editing and combination with other elements.

Highlights

Introduction to powerful AI for background removal in Automatic 1111 and comfi.

Automatic 1111 extension called 'stable diffusion web UI RMG' for background removal.

Instructions on installing and applying the 'stable diffusion web UI RMG' extension.

Limitation of the extension that it doesn't work directly in the text to image tab.

Process of creating an image first and then removing the background using 'send to extras'.

Different methods of background removal such as U-Net, P-UUNet, Human-Sack, and Cloth-Sack.

Cloth-Sack method's ability to split different clothing items into separate parts.

Importance of avoiding overlays in clothing for accurate background removal.

How to generate an image with a removed background as a PNG download.

Checking the edges and small gaps for a good background removal result.

Adjusting alpha matting values for foreground and background threshold.

Using an erode size setting to adjust detail level in background removal.

Advantages of using a gray studio background for non-interference with colors.

Transition to using comfi for more powerful background removal and combination.

Workflow preparation in comfi with character rendering and background combination.

Explanation of rendering a character in a studio on a gray background for color separation.

Using different comfi packs for background removal: Layer Style, VAS Not, and Mixlab Pack.

Layer Style pack's method of creating a mask for background removal.

VAS Not pack's direct background removal method providing a PNG with no background.

Mixlab Pack's easy method of choosing between different background removal techniques.

Final step of combining images and rendering over them for a better blend.

Limitations of the method such as not changing perspective or light colors on the person.

Encouragement to explore more complex and refined results in comfi.