{"id":39832,"date":"2025-07-23T09:26:56","date_gmt":"2025-07-23T01:26:56","guid":{"rendered":"https:\/\/www.1ai.net\/?p=39832"},"modified":"2025-07-20T14:42:05","modified_gmt":"2025-07-20T06:42:05","slug":"flux-kontext-%e4%bd%bf%e7%94%a8%e6%8c%87%e5%8d%97%ef%bc%8c%e4%b8%a4%e7%a7%8d%e6%96%b9%e6%b3%95%e5%ae%9e%e7%8e%b0ai%e5%9b%be%e7%89%87%e7%b2%be%e5%87%86%e5%b1%80%e9%83%a8%e9%87%8d%e7%bb%98","status":"publish","type":"post","link":"https:\/\/www.1ai.net\/en\/39832.html","title":{"rendered":"Flux Kontext guide, two methods to achieve accurate local redrawing of AI images"},"content":{"rendered":"<p><a href=\"https:\/\/www.1ai.net\/en\/tag\/kontext\" title=\"[See articles with [Kontext] label]\" target=\"_blank\" >Kontext<\/a>Editing of images can be achieved in a single sentence, allowing the<a href=\"https:\/\/www.1ai.net\/en\/tag\/ai%e7%bb%98%e5%9b%be\" title=\"_OTHER ORGANISER\" target=\"_blank\" >AI Drawing<\/a>is much more playable, but if we want to have precise control over the localization in the picture, Kontext is sometimes a bit out of reach.<\/p>\n<p>Open the official kontext workflow template, import a photo of a white goose wearing a crown, enter the prompt \"change background to lake\", and the background is easily changed to a lake.<\/p>\n<p>Kontext is really fast and accurate for operations like changing backgrounds.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39833\" title=\"049f3863j00szopt000gad000u000iym\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/049f3863j00szopt000gad000u000iym.jpg\" alt=\"049f3863j00szopt000gad000u000iym\" width=\"1080\" height=\"682\" \/><\/p>\n<p>But if I want to make local edits to some complex images, such as the following picture, I want to make this goose in front of the right side of the picture become blue, at this time, on the one hand, the language description may not be accurate, and on the other hand, even if we describe it accurately, the Kontext may understand it incorrectly.<\/p>\n<p>If you don't believe me, let's try it with the cue word \"Make the goose in front of you on the right blue.\"<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39834\" title=\"b782381aj00szopt201eid000sg00sgm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/b782381aj00szopt201eid000sg00sgm.jpg\" alt=\"b782381aj00szopt201eid000sg00sgm\" width=\"1024\" height=\"1024\" \/><\/p>\n<p>Obviously, Kontext didn't understand me very well, and Kontext turned all the geese in the picture blue.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39837\" title=\"f944de48j00szopt201gnd000sg00sgm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/f944de48j00szopt201gnd000sg00sgm.jpg\" alt=\"f944de48j00szopt201gnd000sg00sgm\" width=\"1024\" height=\"1024\" \/><\/p>\n<p>So, to make precise edits to localized parts of the picture, you have to use localized repaints.<\/p>\n<p>I. Local repainting - local coloring<\/p>\n<p>In Kontext, it is not possible to achieve our purpose by directly redrawing the original image locally and then giving instructions for the operation.<\/p>\n<p>The correct way to do this is to make a copy of the loaded image node, one of which is used for editing the mask, and then add a \"color override\" node to specify the color of the masked area, for example, the color number of red is \"#FF0000\", and then operate on this color area.<\/p>\n<p>The node connection diagram is shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39835\" title=\"b0d01cb0j00szopt000god000u000jxm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/b0d01cb0j00szopt000god000u000jxm.jpg\" alt=\"b0d01cb0j00szopt000god000u000jxm\" width=\"1080\" height=\"717\" \/><\/p>\n<p>By giving the cue word \"turn the red part into a blue goose\", we have achieved precise control over the picture.<\/p>\n<p>As you can see from the picture, when we drew the mask before, we only drew the body of the goose, and its reflection was not drawn, but in the final picture, Kontext changed the color of its reflection to blue.<\/p>\n<p>Kontext's attention to detail is still very good.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39836\" title=\"d678f404j00szopt100m2d000u000h4m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/d678f404j00szopt100m2d000u000h4m.jpg\" alt=\"d678f404j00szopt100m2d000u000h4m\" width=\"1080\" height=\"616\" \/><\/p>\n<p>The use of this method has been described in previous articles, so if you are interested, you can go through the previous articles:<\/p>\n<h4><a href=\"https:\/\/www.1ai.net\/en\/38953.html\/\">Flux Kontext AI painting tutorials, a sentence to get the image editing<\/a><\/h4>\n<p>90% workflow can be thrown away, AI painting has become so simple, universal P chart model kontext advanced operation skills<\/p>\n<p>Kontext-Ipainting Plugin<\/p>\n<p>1. Plug-in installation<\/p>\n<p>Kontext has a specialized plugin for local repainting: Kontext-Inpainting.<\/p>\n<p>With this plugin, Kontext will only edit the masked area, not the area outside the mask.<\/p>\n<p>Plugin Address:<\/p>\n<p>https:\/\/github.com\/ZenAI-Vietnam\/ComfyUI-Kontext-Inpainting<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39838\" title=\"9db471e1j00szopsz001ed000mc00ffm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/9db471e1j00szopsz001ed000mc00ffm.jpg\" alt=\"9db471e1j00szopsz001ed000mc00ffm\" width=\"804\" height=\"555\" \/><\/p>\n<p>The installation method of the plugin can be found in the article:<\/p>\n<h4><a href=\"https:\/\/www.1ai.net\/en\/37613.html\/\">AI Painting ComfyUI Getting Started Tutorial, ComfyUI Workflow Custom Node Installation<\/a><\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39839\" title=\"16d0dfe5j00szopsz0022d000u0008am\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/16d0dfe5j00szopsz0022d000u0008am.jpg\" alt=\"16d0dfe5j00szopsz0022d000u0008am\" width=\"1080\" height=\"298\" \/><\/p>\n<p>2. Workflow utilization<\/p>\n<p>Once the plugin is installed, go to the workflow directory in the plugin directory to find the official default workflow.<\/p>\n<p>The difference between this workflow and the Kontext default workflow is the addition of a \"Kontext Inpainting Conditioning\" node.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39840\" title=\"03c35b59j00szopt00052d000u000ism\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/03c35b59j00szopt00052d000u000ism.jpg\" alt=\"03c35b59j00szopt00052d000u000ism\" width=\"1080\" height=\"676\" \/><\/p>\n<p>We want to make the goose in the lower left corner blue, draw the mask, and then give the cue word: Make the goose feathers blue.<\/p>\n<p>The goose's body turns blue, but notice: this time the goose's reflection does not change color!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39841\" title=\"0f0a70cej00szopt000ghd000u000clm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/0f0a70cej00szopt000ghd000u000clm.jpg\" alt=\"0f0a70cej00szopt000ghd000u000clm\" width=\"1080\" height=\"453\" \/><\/p>\n<p>After re-expanding the selection and painting the shaded areas with masks as well, the goslings finally turned blue.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39842\" title=\"1696e653j00szopt000gid000u000dcm\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/1696e653j00szopt000gid000u000dcm.jpg\" alt=\"1696e653j00szopt000gid000u000dcm\" width=\"1080\" height=\"480\" \/><\/p>\n<p>3, feathering the edges of the mask<\/p>\n<p>Look closely at the edges of the goslings, because the edges of our masks are harder, so the goslings are harder in comparison<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39843\" title=\"5bee78d2j00szopt100fgd000lv00f7m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/5bee78d2j00szopt100fgd000lv00f7m.jpg\" alt=\"5bee78d2j00szopt100fgd000lv00f7m\" width=\"787\" height=\"547\" \/><\/p>\n<p>We can add a Mask Expansion node after the mask to give an expansion size and a blur value. The values are not fixed, so we can fine tune them back and forth depending on the situation.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39844\" title=\"9bbc6f53j00szopt00079d000u000d8m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/9bbc6f53j00szopt00079d000u000d8m.jpg\" alt=\"9bbc6f53j00szopt00079d000u000d8m\" width=\"1080\" height=\"476\" \/><\/p>\n<p>By increasing the feathering value, the edges of the mask become less raw.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-39845\" title=\"2675c94dj00szopt000dpd000u000f4m\" src=\"https:\/\/www.1ai.net\/wp-content\/uploads\/2025\/07\/2675c94dj00szopt000dpd000u000f4m.jpg\" alt=\"2675c94dj00szopt000dpd000u000f4m\" width=\"1080\" height=\"544\" \/><\/p>\n<p>That's all for today.<\/p>","protected":false},"excerpt":{"rendered":"<p>Kontext can edit a picture in one sentence, making it much more fun for AI to draw, but if we want to control the part of the picture with precision, Kontext can sometimes seem a little overstretched. Open the officially available kontext workflow template, import a picture of a white goose wearing a crown, enter a hint \u201cconverts the background to the lake\u201d, which can easily be changed for the lake. Kontext is fast and accurate for such operations as changing background. But if I wanted to do some local editing of some of the complex images, like the next one, I wanted to turn the goose in front of the right of the picture into blue, which might not be accurate, on the one hand, and, on the other hand, Kontext, which might be accurate, on the other hand<\/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":[541,4401,4749,7094],"collection":[],"class_list":{"0":"post-39832","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-jiaocheng","7":"category-baike","8":"tag-ai","9":"tag-comfyui","11":"tag-kontext"},"acf":[],"_links":{"self":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts\/39832","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=39832"}],"version-history":[{"count":0,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/posts\/39832\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/media?parent=39832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/categories?post=39832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/tags?post=39832"},{"taxonomy":"collection","embeddable":true,"href":"https:\/\/www.1ai.net\/en\/wp-json\/wp\/v2\/collection?post=39832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}