{"id":29280,"date":"2025-02-23T09:00:36","date_gmt":"2025-02-23T01:00:36","guid":{"rendered":"https:\/\/www.1ai.net\/?p=29280"},"modified":"2025-02-21T21:14:35","modified_gmt":"2025-02-21T13:14:35","slug":"stable-diffusion%e6%80%8e%e4%b9%88%e7%94%a8%ef%bc%9fstable-diffusion%e5%b1%80%e9%83%a8%e9%87%8d%e7%bb%98%e7%9a%84%e9%ab%98%e7%ba%a7%e6%8a%80%e5%b7%a7","status":"publish","type":"post","link":"https:\/\/www.1ai.net\/en\/29280.html","title":{"rendered":"How to use Stable Diffusion Advanced tips for Stable Diffusion localized repainting"},"content":{"rendered":"<p>Today we will continue to explore the advanced techniques of localized repainting, including the mask mode, mask area content processing, knowledge about repainting area, and some notes on localized repainting. We will use AI model face change as a real-world case to help you deeply understand and master the essence of local repainting.<\/p>\n<p>I. Masking mode<\/p>\n<p>Mask mode is a technique we often use in local repainting, which is divided into two modes: repainting masked content and repainting non-masked content, which corresponds to different demand scenarios.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29281\" title=\"dbbf9c0aj00ss1anx0016d000qi007rm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/dbbf9c0aj00ss1anx0016d000qi007rm.jpg\" alt=\"dbbf9c0aj00ss1anx0016d000qi007rm\" width=\"954\" height=\"279\" \/><\/p>\n<p><strong>1. Redraw the content of the mask<\/strong><\/p>\n<p>Ideal for when you need to change a specific area such as a model's background or clothes while keeping the rest of the model unchanged.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29300\" title=\"c31757a1j00ss1bfn01bdd000u000u0p\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/c31757a1j00ss1bfn01bdd000u000u0p.jpg\" alt=\"c31757a1j00ss1bfn01bdd000u000u0p\" width=\"1080\" height=\"1080\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29301\" title=\"2beff79ej00ss1bf4016vd000qo00qop\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/2beff79ej00ss1bf4016vd000qo00qop.jpg\" alt=\"2beff79ej00ss1bf4016vd000qo00qop\" width=\"960\" height=\"960\" \/><\/p>\n<p><strong>2. Redraw non-masked content<\/strong><\/p>\n<p>Ideal for all areas where the face needs to be preserved and all areas outside the face need to be altered.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29302\" title=\"c31757a1j00ss1bed01bdd000u000u0p\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/c31757a1j00ss1bed01bdd000u000u0p.jpg\" alt=\"c31757a1j00ss1bed01bdd000u000u0p\" width=\"1080\" height=\"1080\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29303\" title=\"ecff93a2j00ss1bdl01d8d000qo00qop\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/ecff93a2j00ss1bdl01d8d000qo00qop.jpg\" alt=\"ecff93a2j00ss1bdl01d8d000qo00qop\" width=\"960\" height=\"960\" \/><\/p>\n<p>By adjusting the mask mode, we can precisely control which areas need to be redrawn to achieve the desired effect.<\/p>\n<p>Second, the mask area content processing<\/p>\n<p>Masked area content handling is the most difficult part of localized repainting to master, but it is also the most critical. It involves how to completely erase the original image information and fill in new content where the mask has been applied.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29284\" title=\"4f517069j00ss1anx001id000q6009km\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/4f517069j00ss1anx001id000q6009km.jpg\" alt=\"4f517069j00ss1anx001id000q6009km\" width=\"942\" height=\"344\" \/><\/p>\n<p><strong>1. Filling mode<\/strong><\/p>\n<p>Fill the mask area with the blurred pixels of the original image, slightly refer to the tone of the original image for repainting, the repainting amplitude should be greater than 0.8.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29286\" title=\"dbc2fe25p00ss1anz005jd000u00035m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/dbc2fe25p00ss1anz005jd000u00035m.png\" alt=\"dbc2fe25p00ss1anz005jd000u00035m\" width=\"1080\" height=\"113\" \/><\/p>\n<p><strong>2. Original Mode<\/strong><\/p>\n<p>The most commonly used mode, based on the original image on the basis of laying noise and then denoising, redrawing the magnitude of the small time with the original image correlation is high, large time is irrelevant, redrawing the magnitude of the magnitude of 0-1 can be between.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29287\" title=\"90d713a3p00ss1anz005nd000u00035m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/90d713a3p00ss1anz005nd000u00035m.png\" alt=\"90d713a3p00ss1anz005nd000u00035m\" width=\"1080\" height=\"113\" \/><\/p>\n<p><strong>3. Latent space noise<\/strong><\/p>\n<p>Filled with noise to completely erase the information of the original image, the redrawing effect is so thorough that the redrawing amplitude should be greater than 0.8.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29290\" title=\"97b3b34dp00ss1anz005wd000u00035m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/97b3b34dp00ss1anz005wd000u00035m.png\" alt=\"97b3b34dp00ss1anz005wd000u00035m\" width=\"1080\" height=\"113\" \/><\/p>\n<p><strong>4. Gap latent space<\/strong><\/p>\n<p>After erasing all the original information, fill in a uniform brown color to achieve a consistent redraw of the base map color, and the redraw margin should be greater than 0.8.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29288\" title=\"8bd44eacp00ss1anz005ld000u00035m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/8bd44eacp00ss1anz005ld000u00035m.png\" alt=\"8bd44eacp00ss1anz005ld000u00035m\" width=\"1080\" height=\"113\" \/><\/p>\n<p>Third, redraw area: the whole picture and only the mask area<\/p>\n<p>The setting of the redraw area determines the<a href=\"https:\/\/www.1ai.net\/en\/tag\/stable-diffusion\" title=\"_Other Organiser\" target=\"_blank\" >Stable Diffusion<\/a>The range of pixels calculated, divided into two options: whole image and masked area only.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29289\" title=\"e785657fj00ss1anw000pd000q4004gm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/e785657fj00ss1anw000pd000q4004gm.jpg\" alt=\"e785657fj00ss1anw000pd000q4004gm\" width=\"940\" height=\"160\" \/><\/p>\n<p><strong>1. Whole picture<\/strong><\/p>\n<p>Considering the content of the whole map to generate the localization, the accuracy of the generation is high, but it is impossible to redraw the oversized map or the high precision redrawing of the small size map.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29291\" title=\"65e4231cj00ss1ao000cmd000e800e8m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/65e4231cj00ss1ao000cmd000e800e8m.jpg\" alt=\"65e4231cj00ss1ao000cmd000e800e8m\" width=\"512\" height=\"512\" \/><\/p>\n<p><strong>2. Masked area only<\/strong><\/p>\n<p>Considering only the redrawn part to generate localized content, independent of resolution, it is suitable for high-precision redrawing of oversized and small-sized drawings.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29297\" title=\"b6cd2577j00ss1ao000cld000e800e8m-1\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/b6cd2577j00ss1ao000cld000e800e8m-1.jpg\" alt=\"b6cd2577j00ss1ao000cld000e800e8m-1\" width=\"512\" height=\"512\" \/><\/p>\n<p><strong>2.1 Reserve pixels for the lower edge of the mask area only<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29298\" title=\"190c1ce2j00ss1anz00cyd000e800e8m-1\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/190c1ce2j00ss1anz00cyd000e800e8m-1.jpg\" alt=\"190c1ce2j00ss1anz00cyd000e800e8m-1\" width=\"512\" height=\"512\" \/><\/p>\n<p><strong>2.2 Effect of edge reserved pixel parameters on facial pixel density<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29296\" title=\"2f3a385ej00ss1anz00cpd000e800e8m-1\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/2f3a385ej00ss1anz00cpd000e800e8m-1.jpg\" alt=\"2f3a385ej00ss1anz00cpd000e800e8m-1\" width=\"512\" height=\"512\" \/><\/p>\n<p>IV. Application Case: AI Model Face Change<\/p>\n<p>We will demonstrate how to apply the theoretical knowledge of localized repainting to real projects through the case of AI model face swap.<\/p>\n<p>By adjusting the mask mode and repainting areas, we can accurately replace the model's face with Lora while keeping the rest of the area consistent.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29282\" title=\"c31757a1j00ss1ao301bdd000u000u0m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/c31757a1j00ss1ao301bdd000u000u0m.jpg\" alt=\"c31757a1j00ss1ao301bdd000u000u0m\" width=\"1080\" height=\"1080\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-29299\" title=\"6d46b937j00ss1ao2017gd000qo00qom-1\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/02\/6d46b937j00ss1ao2017gd000qo00qom-1.jpg\" alt=\"6d46b937j00ss1ao2017gd000qo00qom-1\" width=\"960\" height=\"960\" \/><\/p>\n<p>V. Summary<\/p>\n<p>In this section, we have learned the advanced knowledge of Stable Diffusion local repainting, these knowledge is difficult, but through repeated practice and practice, I believe you will be able to integrate these knowledge points. In future projects, these skills will shine.<\/p>\n<p>I hope this article can help you deeply understand Stable Diffusion's local redraw feature and flexibly use it in real projects.<\/p>","protected":false},"excerpt":{"rendered":"<p>Today we will continue to explore the advanced techniques of localized repainting, including the mask mode, mask area content processing, knowledge about repainting area, and some notes on localized repainting. We will use the AI model face change as a real-world case to help you deeply understand and master the essence of local repainting. I. Masking Mode Masking mode is a technique we often use in local repainting, which is divided into two modes: repainting masked content and repainting non-masked content, corresponding to different demand scenarios. 1. Repaint Mask Content It is suitable for changing the background or clothes of the model, while keeping the other parts unchanged. 2. Redraw Unmasked Content is used when you need to keep the face and change all areas other than the face. By adjusting the mask mode, we can precisely control which areas need to be repainted to<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[149,144],"tags":[2328,197,198],"collection":[262],"class_list":{"0":"post-29280","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-jiaocheng","7":"category-baike","8":"tag-ai","9":"tag-stable-diffusion","11":"collection-stablediffusion"},"acf":[],"_links":{"self":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts\/29280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/comments?post=29280"}],"version-history":[{"count":0,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts\/29280\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/media?parent=29280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/categories?post=29280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/tags?post=29280"},{"taxonomy":"collection","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/collection?post=29280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}