Paint Your Dreams, Not Your Wallet! – 重绘梦想,不重绘钱包!
Video tutorial - 视频教程
Introduction – 序言
Welcome, ComfyUI enthusiasts! If you've been following our tutorials, you're probably already running ComfyUI locally and mastering the basics. But hold onto your pixelated hats, because today we're diving into the magical world of inpainting - the art of selectively repainting parts of an image. It's like giving your pictures a partial makeover without the expensive salon visit! Whether you're a digital Picasso or just someone who wants to remove that photobombing squirrel from your family portrait, inpainting is your new best friend. So, grab your virtual paintbrush, and let's turn those "oops" into "wow" without breaking the bank or your sanity. Who knows? By the end of this, you might just be the neighborhood's go-to digital plastic surgeon!
欢迎各位ComfyUI爱好者!如果你一直在跟着我们的教程学习,想必你已经能在本地运行ComfyUI,并掌握了基本操作。但是,各位请握紧你们的像素帽子,因为今天我们要深入探讨重绘的魔法世界 - 这项在图片中选择性重新绘制部分内容的艺术。这就像给你的照片做局部整容,而且不用花大价钱!无论你是数字世界的毕加索,还是只想把family photo里那只爱抢镜的小松鼠P掉的普通人,重绘都将成为你的新宠。所以,拿起你的虚拟画笔,让我们一起把"哎呀"变成"哇哦",既不伤钱包也不伤脑细胞。说不定到最后,你就成了街坊邻里公认的数字整容专家!
Basic Inpainting Techniques – 基础重绘技巧
So, you’re diving into the world of inpainting with ComfyUI, huh? Well, congratulations! But remember, just like that ancient Chinese proverb says, “A journey of a thousand miles begins with a single step.” No one becomes a pro overnight, so let’s start from the basics, and yes, that means copying the official example. Trust me, it’s not cheating; it’s smart learning!
Head on over to the ComfyUI GitHub page, scroll down a bit, and click on ComfyUI Examples. There, you’ll find our golden ticket: the Inpainting Example—this is what we’ll be using as the blueprint for our inpainting mastery. Now, why start here? Because, just like a giant tree starts as a tiny seed, you’ve got to grow your skills from the basics. Download the images from the example: the first is a damaged image that needs fixing, and the second is the magically restored image with a cat(You have to download two pictures). Once you’ve got those, drag the restored image into your ComfyUI window. Boom! Now you can see the whole workflow. What’s next? You need a big model.
For this workflow, the example uses a 512-inpainting model, so head over to Civitai and search for something similar. This turorial recommends “djzGingertomcatV21768V21_21768”, you can choose the one you like. Download it and toss that model into your ComfyUI/models/checkpoints folder. Restart ComfyUI, and you’re golden—well, almost.
Now, here’s where we tweak a little. What if your image size doesn’t match the example’s? No problem! Just double-click on the blank canvas in ComfyUI and type “Upscale Image By,” then hit Enter. Do this a couple more times to add Upscale Image and Preview Image panels. Drag these into the blue group (yes, it’s all about dragging and dropping), and if necessary, resize the group to fit your newfound panels. You’re becoming a workflow artist now!
Got all that? Good. Let’s adjust some settings. First, in the Load Checkpoint panel, select that fancy model you downloaded. We won’t mess with the prompts this time; speed is key. Set the KSampler steps to 16 for a quick result—because who has time to wait forever, right? Drag that damaged image into the Load Image panel, and make sure the output size in the Upscale Image panel is set to 768x768. Now, press Queue Prompt and wait for the magic.
For those running without a GPU, just run ComfyUI with --cpu(python main.py –cpu), like a warrior in slow motion. It might take some time, but hey, patience is a virtue, especially when inpainting with a potato-powered machine. By the end, you’ll have a shiny new cat image, and more importantly, you’ll be one step closer to inpainting mastery.
那么,你要用 ComfyUI 来学习重绘对吧?恭喜你!不过,老话说得好,“千里之行,始于足下。”想要成为大神,可不是一天就能搞定的!所以咱们要从基础开始学习,没错,就是模仿官方的例子。这不叫作弊,这叫聪明的学习方式!
首先,打开 ComfyUI GitHub 页面,往下滑,找到 ComfyUI Examples 链接。点进去,你会发现我们要用的宝贝—— Inpainting Example。这就是我们要模仿的例子!为什么要从这里开始?因为嘛,就像参天大树从一粒种子开始,技术也是要从基础练起。下载那个带缺损的图(需要重绘的),还有重绘完成的有猫的图片。(要下载两张图)下载完毕,把那张有猫的图拖进 ComfyUI 界面。工作流直接展示在你面前!接下来你需要一个 大模型。
这个例子用的是 512-inpainting model,所以赶紧去 Civitai 搜索一下。在本教程里推荐了“djzGingertomcatV21768V21_21768, 你可以选你喜欢的。”下载后,把模型丢进你的 ComfyUI/models/checkpoints 文件夹。重启 ComfyUI,差不多就准备好开始了。
接下来咱们稍微调整一下。如果你图片的尺寸和例子不一样,没问题!在 ComfyUI 空白处双击,输入“Upscale Image By”,然后按回车。再重复两次,添加 Upscale Image 和 Preview Image 面板。把这些新加的面板拖到浅蓝色组里(是的,全靠拖拽),如果地方不够,你可以把组拉大一点。现在,你已经成为了工作流高手,高手,高高手!
好了,现在开始调整设置。先在 Load Checkpoint 面板里选择你下载的模型。这次提示词就不改了,咱们要快点出结果嘛!把 KSampler 的步数设置成 16,这样可以快点生成结果。把之前下载的缺损图片拖到 Load Image 面板里,确保Upscale Image的尺寸设置为 768x768。然后按一下 Queue Prompt 按钮,等待几秒,魔法就会发生了。
对于没有 GPU 的小伙伴,启动 ComfyUI 时加上 --cpu(python main.py –cpu),慢慢来,耐心等待。虽然时间可能会有点长,但,嘿,慢工出细活嘛!最终你会得到一张崭新的有猫的图片,更重要的是,你离重绘大神又近了一步!

Advanced Tricks: No GPU? No Problem! – 进阶秘笈: 没显卡?照样玩!
So, you’ve got no GPU? No problem! I’m right there with you, because guess what? My computer doesn’t have one either! But does that stop us from diving deep into ComfyUI’s inpainting magic? Absolutely not. In fact, it just makes us more resourceful, like a chef cooking a gourmet meal with nothing but a toaster oven. Let’s turn this challenge into an opportunity to learn some advanced tricks, all while keeping our wallets safe!
First thing’s first: we need to start fresh. Open your terminal and hit Ctrl + C to stop ComfyUI. Then, restart it by typing "python main.py". Once ComfyUI is back up, hit Clear on the main panel. Now, let’s clean up our workspace—select the blue group, right-click, choose Edit Group, and remove it. Bye-bye, group! We’re keeping things lean and mean. Then, delete the old “VAE Encode (for Inpainting)” panel—yeah, it’s time for an upgrade. Double-click on the blank canvas, type “VAE Encode”, and hit Enter. Repeat that for “Set Latent Noise Mask”. The 2nd panel will help us work with masked images, kind of like the missing parts we’ve dealt with before, but now, it’s on our terms. Once you’ve added these shiny new panels, just drag them into place like you’re organizing furniture in a tiny apartment.
Next up: the AI model. This time, we’re using the realisticVisionV60B1_v51HyperVAE model, so head over to Civitai and download that bad boy. Pop it into your ComfyUI/models/checkpoints folder, give ComfyUI a quick restart, and select the model in the Load Checkpoint panel. Boom, we’re ready to inpaint! Need an image? Here’s a fun trick: go to a random human face website. Just keep refreshing until you find the perfect face to work on. Load that image into the Load Image panel. A quick explanation of masking: The purpose of masking is to create areas that need to be redrawn. In the ‘Load Image’ panel, right-click and select ‘Open in MaskEditor’. Adjust the Thickness (brush size) and Opacity (visibility), then paint over the areas you want to redraw. Press the Option/Alt key to clear masked areas. Once you’ve finished masking the areas, click the ‘Save to node’ button, and you’re done. The masked areas are the ones that will be redrawn.
Now, for the magic touch—let’s talk settings. The forward prompt I used is simple but effective: “A person wearing a golden eye patch, high resolution, 4k.” Fancy, right? As for the negative prompt—nah, no changes there. In KSampler, set the steps to 24 and denoise to 0.6. Hit that Queue Prompt button, and give it a minute to work its magic.
The result? A crisp, detailed image that’s not only cool but also won’t take ages to generate like before. No GPU, no stress, just pure inpainting goodness! See, you don’t need to break the bank to create masterpieces. Patience, creativity, and a little bit of know-how are all you need!
没显卡?没问题!其实,我的电脑也没有显卡!但这能阻挡我们探索 ComfyUI 重绘的奥秘吗?当然不能!这反而让我们更有创意,就像一个厨师只用烤面包机做出了一顿美味大餐。让我们把挑战变成机会,学习一些进阶的重绘技巧,还不用掏空钱包!
首先,我们需要从头开始。打开终端,按 Ctrl + C 停止 ComfyUI。然后输入命令 "python main.py" 重新启动它。ComfyUI 启动后,先点击主面板上的 Clear 清空界面。接下来,咱们得稍微整理一下工作区——选中蓝色组,右击,选择 Edit Group,然后移除它。没错,咱们要轻装上阵。接着删除旧的 “VAE Encode (for Inpainting)” 面板,是时候升级了。双击空白处,输入 “VAE Encode”,按回车。再重复一次,输入 “Set Latent Noise Mask”。第二个面板将帮助我们处理遮罩图像,有点像之前处理缺失部分的方式,但现在我们更灵活。添加好这些新面板后,像摆家具一样把它们拖到合适的位置。
接下来是AI模型。这次我们用的是 realisticVisionV60B1_v51HyperVAE,去 Civitai 下载这个模型吧。下载后,把它放到 ComfyUI/models/checkpoints 文件夹,重启 ComfyUI,然后在 Load Checkpoint 面板里选择它。大功告成!现在我们准备开始重绘了!需要一张图片?我有个好主意:去随机人脸网站,不满意就刷新,直到找到你满意的脸,把它拖到 Load Image 面板里。快速讲一下遮罩, 遮罩的目的就是创建需要重绘的区域。在Load Image panel里右击,选择“Open in MaskEditor”. 调整好Thickness(画笔粗细), Opacity(可见度)。然后涂抹你想要重绘的地方。按Option/alt按键,可以清除遮罩的区域。画好要遮罩的区域后,点“Save to node” 按钮,就可以了。遮罩的区域就是我们会重绘的区域。
好了,接下来就是魔法时刻——设置一下参数。我用的正向提示词是:“A person wearing a golden eye patch, high resolution, 4k”。是不是很炫酷?反向提示词就不修改了。在 KSampler 面板里,步数设为 24,降噪值设为 0.6。点击 Queue Prompt 按钮,稍等片刻,看看魔法发生!
结果呢?生成了一张清晰细致的图片,不仅效果不错,而且生产速度比之前快了不少。显卡没有?没关系!我们照样能用重绘技巧,创作出精美的作品。不用花大钱,只需要一点耐心、创意和技术!
Tip: inpainting AI model – 妙招: 直接用重绘AI模型
Ever felt like your inpainting skills are stuck in the kiddie pool? Fear not, fellow art adventurer! First, go to Civitai to download a model specifically for inpainting. In this tutorial, the model used is Realistic v6 B1 Inpainting.
Those fancy re-painting AI models can do the heavy lifting for you. Let's ditch the "VAE Encode" and "Set Latent Noise Mask" panels – they're yesterday's news. Just double-click on the empty workspace and type in "VAE Encode (for Inpainting)". Hook it up like the awesome image in the guide, and then get ready to unleash your inner prompt master!
Remember that person we made with an eye patch? This time, we'll use the same positive prompt: "A person wearing a golden eye patch, high resolution, 4k." And for the negative prompt, well, we can totally reuse our old friend – "blurry, low-quality, distorted, deformed, extra limbs, missing limbs, text, watermark, unrealistic proportions, oversaturated, overexposed, underexposed, pixelated, noisy background, overcomplicated design, messy, poorly lit, cropped faces, too much contrast, overly detailed, unwanted objects, duplicate elements" You know the drill.
In the KSampler panel, crank the "denoise" setting to 0.66. Hit the "Queue Prompt" button, and hold on to your socks! ComfyUI will churn out a masterpiece that would make even the pickiest people proud.
有没有觉得你的修复技巧停滞不前?别担心,艺术冒险家们!首先去Civitai下载专用于inpainting的模型, 在本教程中用的是realistic v6 B1 inpainting.
那些花哨的重绘 AI 模型可以帮你完成繁重的工作。让我们抛弃"VAE Encode"和 "Set Latent Noise Mask"面板 - 它们已经过时了。只需在空白工作区上双击并输入“VAE Encode (for Inpainting)” 。 像指南中的那张酷图一样连接它,然后准备释放你内心的提示大师吧!
还记得我们之前做过的戴眼罩的人吗?这次,我们将使用相同的正向提示语:“A person wearing a golden eye patch, high resolution, 4k”(提示词目前不支持中文)。至于负面提示语,我们可以完全重复使用我们以前的老朋友——“blurry, low-quality, distorted, deformed, extra limbs, missing limbs, text, watermark, unrealistic proportions, oversaturated, overexposed, underexposed, pixelated, noisy background, overcomplicated design, messy, poorly lit, cropped faces, too much contrast, overly detailed, unwanted objects, duplicate elements” 你懂的。
在 KSampler 面板中,将“denoise”设置调到 0.66。 点击“Queue Prompt”按钮,然后屏住呼吸!ComfyUI 将会生成一个杰作,让即使是最挑剔的人也会感到自豪。
Conclusion – 尾声
Keep going and master this fun skill! The unspeakable scenes or images you might generate in the near future… well, that’s just art calling!
合抱之木,生于毫末;九层之台,起于累土;千里之行,始于足下。那些在不久的将来你们可能会生成的不可描述的场景或者图片,都是艺术的感召。
No comments:
Post a Comment