[Tutorial] Stable Diffusion Nudify (Clothing to Nude)

[Tutorial] Stable Diffusion Nudify (Clothing to Nude)

g

By gerogero

Updated: June 25, 2024

You should already have Automatic1111 installed and updated. Check the beginner’s guide if not.
You will need the following models to follow along with this:

Here’s a quick guide on the workflow. we’re able to invent new parts of the image that didn’t exist before.:


This all takes a bit of time and patience, but the results are well worth it. This one was actually a rush job so I had something to sue for this example, and it still looks pretty decent! A lot more time could be spent refining it, but I think it’s enough to get the message across.The best part is, this method works on people who are fully clothed, so you don’t need an image of them wearing a bikini. Anything will do

Here’s the basic steps I use to achieve something like this:

  1. Before doing anything, make sure to go to settings and check “Apply color correction to img2img results to match original colors.” Also check “Save a copy of image before applying color correction to img2img results.” This can come in handy, as sometimes the nude looks great in the preview, until it finishes and colour corrects back to the colour of the clothes that were once there. If this happens, go to your image folder and use the non colour corrected version.
  2. Another important thing to note is that you may want to avoid using large images. I’ve found best practice is to just open the image on your monitor and use the snipping tool to grab a screenshot of it. Then you can check “Inpaint at full resolution” and everything will work great. Going in with higher res images can sometimes lead to unexpected results, but sometimes it works too so do whatever you want.
  3. First use sd-v1-5-inpainting.ckpt, and mask out the visible clothing of someone. Add a prompt like “a naked woman.” Sometimes it’s helpful to set negative promps. I use “clothes, clothing, cloth.” Set to fill. Sampling method=Euler, steps=80 (Sometimes 80 is too high, so feel free to try 40 as well), CFG=7, Denoising=0.75
  4. Switch to f222.cpkt. Mask the entire body. Set to original. Sampling method=Euler, steps=80, CFG=7, Denoising=0.3 (Go lower to keep it closer to what’s already there, higher to generate a slightly better version. Just don’t go too high or you’ll get something different all together).
  5. For outpainting (creating parts of the image that don’t exist) switch back to sd-v1-5-inpainting.ckpt. You can try Fill or Original for this, but usually Original works best. Sampling method=Euler a, steps=80, CFG=7, denoising=0.8. It’s best practice to only outpaint in one direction at a time. As for the prompt, you don’t need to include too much. You could just use “A naked woman standing,” but sometimes something like “a naked woman squatting” or “a naked woman sitting” does the trick. It’s not always necesary, but you may include some background elements. For this one I simply put “a naked woman squatting, legs spread, splits.”
  6. Once you’ve got an outpainted image that you are happy with, use sd-v1-5-inpainting.ckpt with the same settings as earlier to remove or fix up anything you don’t like. Then switch over to f222.cpkt to clean up the body a bit and make it blend in wit the rest.
  7. Repeat all steps until done!

I hope this information is helpful to some people. Of course, there are various approaches that could be utilized to address the issue. With the use of Photoshop, you can even make rough adjustments to the pose of individuals, re-import them, and repeat the same steps multiple times. There is also the option to obscure someone’s face using a mask and then complete the rest of the image. So many options. Enjoy! 

Method 2

Let’s start with an image that you would like to nudify.

Since I don’t want to use any copyrighted image for this tutorial, I will just use one generated with Stable Diffusion. It’s a great image, but how do we nudify it?

Keep in mind this image is actually difficult to nudify, because the clothing is behind the legs. Most images will be easier than this, so it’s a pretty good example to use.

Step 1

Open AUTOMATIC1111 (and make sure it is fully updated). Check out the starter tutorial if you have not installed this software yet.

Step 2

We will be using the extension “Inpaint anything”.

https://github.com/Uminosachi/sd-webui-inpaint-anything

Use “inpaint anything” to create mask and send to “inpaint Upload” tab

3-2 use controlnet inpaint mode

3-3 use controlnet open pose mode

3-4 modify prompt words.

3-5 roll and get the best one.

Best quality,masterpiece,ultra high res,(photorealistic:1.4),girl’s upper body,nude,arms,breasts,(nipples:1.2),detailed areolas,detailed nipples, Negative prompt: paintings,sketches,(worst quality:2),(low quality:2),(normal quality:2),lowres,normal quality,((monochrome)),((grayscale)),skin spots,acnes,skin blemishes,age spot,manboobs,backlight,(ugly:1.331),(duplicate:1.331),(morbid:1.21),(mutilated:1.21),(tranny:1.331),mutated hands,(poorly drawn hands:1.331),blurry,(bad anatomy:1.21),(bad proportions:1.331),extra limbs,(disfigured:1.331),(more than 2 nipples:1.331),(missing arms:1.331),(extra legs:1.331),(fused fingers:1.61051),(too many fingers:1.61051),(unclear eyes:1.331),bad hands,missing fingers,extra digit,(futa:1.1),bad body,ng_deepnegative_v1_75t,easynegative, Steps: 30, Sampler: Euler a, CFG scale: 7, Model: majicmixRealistic_v7, , Denoising strength: 0.75