Stable Diffusionで画像の一部だけを変更する方法

29 Apr 202304:39

TLDRThis video tutorial introduces a method to alter specific parts of an image using Stable Diffusion. It guides viewers through the process of accessing Stable Diffusion via Google Colab, inputting prompts to generate desired images, and using the 'Image to Image' tab for targeted modifications. The example demonstrates changing the color of a swimsuit from blue to red by painting the desired area black and adjusting the 'Denoise Strength' parameter. The video encourages viewers to create their own customized images and offers additional resources for learning about AI and programming.


  • 🎨 The video introduces a method to change specific parts of an image using Stable Diffusion technology.
  • 🔍 Access Stable Diffusion through Google Colab, as previously explained in another video tutorial.
  • 📝 Enter prompts into Stable Diffusion to guide the creation of the desired image, following the instructions provided in the summary tab.
  • ✅ Use negative prompts to specify what should be avoided in the image, such as low quality or certain artifacts.
  • 🖌️ After inputting prompts, click the 'Generate' button to produce new images based on the provided criteria.
  • 🖼️ Save the generated images to your computer by right-clicking and selecting 'Save Image As'.
  • 🔄 Use the 'Image to Image' tab in Stable Diffusion to upload the saved image for further editing.
  • 🎨 Modify the image by inpainting the specific area you wish to change, such as changing the color of a swimsuit from blue to red.
  • 🔧 Adjust the 'Denoise Strength' parameter to control the extent of the changes made to the image.
  • 🔄 Regeneracy the image to see the changes applied, such as the color change in the swimsuit.
  • 📢 The video encourages viewers to subscribe to the channel for more AI-related content and access to a Q&A service with professional engineers.

Q & A

  • What is the main topic of the video?

    -The main topic of the video is how to use Stable Diffusion to change specific parts of an image, such as altering the color of clothing in a selected image.

  • Which platform is used to access Stable Diffusion in the video?

    -Google Colab is used as the platform to access Stable Diffusion.

  • What is the purpose of the prompt in Stable Diffusion?

    -The prompt serves as an instruction to Stable Diffusion, telling it what kind of image to create based on the text provided.

  • What is a Negative Prompt in the context of Stable Diffusion?

    -A Negative Prompt is used to specify what elements should be avoided in the generated image, such as low-quality images or certain undesirable features.

  • How does one generate an image using Stable Diffusion?

    -To generate an image, one inputs the prompt and negative prompt, then clicks the 'Generate' button, which creates a new image with each press.

  • What should you do after you have selected the desired image?

    -After selecting the desired image, it should be downloaded to your personal computer by right-clicking and choosing 'Save Image As'.

  • How can you make changes to a specific part of an image using Stable Diffusion's Image to Image feature?

    -You can make changes by clicking on the 'Image to Image' tab, uploading the selected image, re-entering the prompt and negative prompt, and then specifying the changes by blacking out the area you want to modify.

  • What is the Denoising Strength setting used for in Stable Diffusion?

    -Denoising Strength determines the degree of change applied to the image. Higher values result in more significant changes, while lower values result in subtler modifications.

  • What is the final result of changing the color of a swimsuit in the video example?

    -The final result is an image where the swimsuit color has been changed from blue to red.

  • What type of content does the channel provide?

    -The channel provides information about AI and web utilities, as well as a Q&A service for those learning programming and prompts engineering, where they can ask questions to a professional engineer.

  • How can viewers stay updated with the content of the channel?

    -Viewers are encouraged to subscribe to the channel to stay updated with new content.



🎨 How to Change Specific Parts of an Image using Stable Diffusion

This paragraph introduces the method of altering specific parts of an image using Stable Diffusion. It encourages viewers with a particular image in mind, such as wanting to change the color of clothing, to watch the video to achieve this. The process begins by accessing Stable Diffusion through Google Colab, which is explained in a previous video. Users are guided to input prompts, which are instructions on what kind of image to create, and negative prompts to avoid certain elements like low-quality images or watermarks. After inputting these, users click the generate button to create new images. The video then instructs on selecting the desired image, downloading it to the computer, and using the 'Image to Image' tab to upload the image for further editing. The prompt is then modified to specify the desired change, such as changing the color of a swimsuit from blue to red. The editing involves blacking out the area to be changed and adjusting the denoising strength to control the extent of the changes. The final step is to generate the edited image, demonstrating how Stable Diffusion can be used to modify specific parts of an image.



💡Stable Diffusion

Stable Diffusion is a type of artificial intelligence model designed to generate or manipulate images based on textual descriptions provided to it. In the context of the video, Stable Diffusion is accessed using Google Colab to selectively modify parts of an image, such as changing the color of clothing. The video illustrates how users can leverage this technology to realize specific visual ideas, emphasizing its utility in creative processes.

💡Google Colab

Google Colab is a free cloud service that supports Python programming execution and is widely used for machine learning and data analysis projects. The video explains how Google Colab serves as the platform for accessing and utilizing Stable Diffusion, highlighting its role in making advanced AI technologies accessible for personal use, particularly in image generation and manipulation.


In the realm of AI-generated content, a prompt is a textual instruction that guides the AI on what to create or modify. The video discusses entering a prompt to instruct Stable Diffusion on the specific changes to be made to an image, such as altering clothing colors. This highlights the importance of clear and precise prompts in achieving desired outcomes with AI image manipulation.

💡Negative Prompt

A negative prompt is used to instruct the AI on what elements to avoid or remove from the generated images, enhancing the quality of the output by excluding undesired attributes like low quality or specific flaws. The video covers the use of negative prompts to refine the image generation process in Stable Diffusion, underscoring their role in customizing and improving the visual results.

💡Generate Button

The 'Generate' button is the interface element through which users command Stable Diffusion to start the image generation or modification process based on the provided prompts. The video describes clicking this button to create new images, emphasizing the ease of generating multiple iterations to select the best outcome for further modifications.

💡Image to Image

The 'Image to Image' feature in image generation tools like Stable Diffusion allows users to modify an existing image based on new instructions, rather than creating something entirely from scratch. The video showcases using this feature to change specific parts of an image, illustrating its utility in refining or altering particular aspects of visuals.


Inpainting refers to the process of altering specific parts of an image while keeping the rest intact, such as changing a color or removing an object. The video explains how to use the inpainting tab after selecting an image to modify, demonstrating the precision with which users can direct changes to specific image areas using Stable Diffusion.

💡Denosing Strength

Denoising Strength is a parameter in Stable Diffusion that controls the extent of change applied to an image; a higher value results in more significant modifications. The video discusses adjusting this setting to maximize changes, such as altering the color of an item within the image, highlighting the control users have over the intensity of modifications.

💡Save Image

The process of saving the generated or modified image to one's personal computer, as described in the video, involves right-clicking the image and selecting 'Save Image As' from the context menu. This step is crucial for preserving the final outcome of the image modification process for further use or sharing.


Uploading refers to the act of transferring a file from one's personal computer to another location or service, in this case, the platform running Stable Diffusion. The video details uploading a chosen image for modification, emphasizing the preparatory step necessary for applying specific alterations through inpainting and other adjustments.


Introduction to changing specific parts of an image using Stable Diffusion.

Accessing Stable Diffusion through Google Colab.

The importance of inputting prompts to guide the image creation process.

Utilizing negative prompts to avoid undesired elements in the generated images.

Creating images by specifying prompts and negative prompts.

Downloading and saving the generated images to your computer.

Using the Image to Image tab for targeted image modifications.

Uploading a previously saved image for modification.

Copying the original prompt for the image modification process.

Adjusting the prompt to change specific elements of the image, such as the color of a swimsuit.

Painting the area of change with black to indicate the modification.

Specifying the denoising strength to control the extent of changes.

Generating the modified image with the desired changes.

The ability to make targeted changes to images using Stable Diffusion's inpainting feature.

Encouragement to subscribe to the channel for more AI-related content and helpful information.

Mention of a Q&A service for programming and prompt engineering learning.

Link to more information provided in the description section.