Sign In

Creating Hairstyles with SDXL

Creating Hairstyles with SDXL

Did you know that Stable Diffusion is quite good at creating various and unique hairstyles ?

In this article, we will explore the universe of hairstyles generated by artificial intelligence, offering an infinite palette of styles and colors to transform your models and photos.

After examining the haircuts that can be used to complement your prompts and useful keywords for changing the hairstyles of your models, we will also see how to use inpainting to modify the hairstyle of an existing photo and apply a new cut.

This article is the English translation of an article published on my French Blog : Créer des coiffures avec SDXL - ChatGPT helped me with the translation.

SDXL and Hairstyling

Stable Diffusion XL was trained with a very large number of images. Among these images, there are probably many portraits and photos of faces, with a great diversity of hairstyles and haircuts. As with many other elements, it is therefore be enough to introduce the description of the desired hairstyle into the prompt to have SDXL generating it in your images.

46 Haircuts for Your Portraits

Indeed, SDXL knows and recognizes haircuts quite well and can directly generate images with the hairstyles you want, without LoRA or other fine)tuning - if you use the right expression. As we are not all hairstylists, here is a series of tested and approved cuts and hairstyles for Stable Diffusion XL.

All the images have been generated with Fooocus and its default style settings, using the JugernautXL 8 checkpoints with the below prompts - you can also find larger versions of each pictures in the original blog article.

  • 30 years old woman, {hairstyle}, elegant vintage blue dress, studio photo, light background

  • 40 years old latino man, {hairstyle}, blue linen shirt, studio photo, dark background



I tried to be comprehensive in this exploration to offer a wide variety of hairstyles. However, I do not claim to be exhaustive: there are certainly cuts I have forgotten. And you can obviously combine or slightly modify the expressions to create new hairstyles.

As you can see, Stable Diffusion XL does very well as a hairstylist. SDXL is capable of recognizing many hairstyles and generating the corresponding images - even though some hairstyles seem reserved for women and have virtually no effect on a male model's hair.

Hair Colors and Shades

Obviously, you can also play with hair colors. Whether choosing a natural color or using dyes, SDXL knows a thing or two about hair color shades.

For natural colors, there are obviously the classics blond and black, as well as terms like brunette or redhead. But there are also other natural colors and shades that can work with SDXL.

And then, much like with hair coloring and dyeing at the salon, you can use any color you can imagine to color the hair in your images. You can even mix them to create multicolored effects.

For multicolored hair, keywords Ombré and Balayage are also recognized by Stable Diffusion XL and prove very useful. Balayage refers to a soft color change, with a gradient effect, while Ombré corresponds more to a sharp and marked change between colors.

More Styles with LoRAs

As always with Stable Diffusion, the creator community is there to enable us to go beyond what the basic model offers. There are, of course, LoRAs that allow for a variety and creation of even more hairstyles. We have selected two that you might like if you find the hairstyles presented above lacking in originality...

Hair Style

The author of this LoRA does not give much indication on the keywords to use to direct its effects. However, the examples suggest that hairstyle and especially crazy hairstyle work quite well, often in conjunction with an adjective like in Pinterest hairstyle, crazy futuristic hairstyle, or crazy punk hairstyle:

XL All-in-one Hairstyle Bundle

This LoRA actually combines several LoRAs from the same author to offer no less than 7 more type-specific hairstyles - and clearly more inspired by the manga/anime universe than by hair salons.

  • Big Hair adds a lot of body to the hair and makes it massive.

  • Double Bun is perfect for imposing Chinese-style buns.

  • Floofy bob corresponds to a square cut with a lot of volume and curls.

  • Mega ponytail generates wide and voluminous ponytails.

  • Mega twin drills transform the twintails into large spiral braids.

  • Mega twintails adds a quite full and high double ponytail.

  • Ojou curls creates a voluminous hairstyle full of curls

Changing the Hairstyle in a Photo

With the SDXL hairstyle knowledge you now possess, you might want to use AI to change the hairstyle of a character in a photo. Perhaps even test a new hairstyle by applying it to your own photo before going to the hairdresser.

Stable Diffusion XL indeed makes this kind of image modification quite easy.

An effective way to modify an image is to use Inpainting, a technique that involves (re)generating only a part of an image while keeping the rest as it is.

The exact use of Inpainting varies depending on the interface used, but the principle remains the same: select the area of the image you want to modify (the hair and around the face) and provide a prompt that will generate a new hairstyle.

Here's how to do it with two of the most popular interfaces: Fooocus and Automatic1111.


Changing Hairstyles with Fooocus

In Fooocus, the Inpainting feature is found under the Input Image tab, specifically under Inpaint or Outpaint. Here's how to use it to change the hairstyle in a photo.

notion image

  1. Open the Inpainting interface by checking the Input Image box and then selecting Inpaint or Outpaint.

  2. Upload your image to the workspace.

  3. Use the 🖊️ to draw the area of the image that will be redrawn by the AI. Cover all the hair, allowing extra space for the new hairstyle if necessary.

  4. In the Method selector, choose Modify Content.

  5. In the Inpaint Additional Prompt field, enter the description of the desired hairstyle.

  6. In the prompt field, provide a prompt that matches your image, for example, blond mohawk.

  7. Click on Generate.

Changing Hairstyles with Automatic1111

In Automatic1111, the Inpainting feature is located under the img2img tab by selecting Generation > Inpaint.

notion image

  1. When you choose Inpaint, a upload area appears for placing the image you wish to modify.

  2. Drop your photo there and follow the steps below to change the hairstyle.

  3. Select a brush size by clicking on the small 🖊️ at the top right of the image.

  4. Draw on your image to define the area that will be regenerated by the AI. Cover all the hair, planning extra space for the new hairstyle if necessary.

  5. Then set the configuration options as for a classic txt2img generation: Steps, Batch count/size, sampler, CFG Scales,...

  6. Click on the small square 📐 next to the dimensions to use those of your original image or define new ones.

  7. Provide a simple prompt that matches your images and add the details of the desired hairstyle. Example: Portrait of a woman, dark blond hair, blunt bob, studio photo.

  8. Finally, click on the Generate button to start generating your images.

notion imagenotion imageBy allowing the modification and creation of hairstyles with unparalleled ease and flexibility, Stable Diffusion opens the door to limitless hair creativity, whether for personal, artistic, or professional projects.

Whether you are a professional looking to present avant-garde concepts or simply an enthusiast wanting to experiment with different looks, SDXL is an essential resource. With this article, I hope to have illuminated the possibilities offered by SDXL in the field of hairstyles, and to encourage you to explore this area in your next creations.

12

Comments