Using Hasdx to create an AI-generated adult coloring book (includes prompts!)

Using Hasdx to create an AI-generated adult coloring book (includes prompts!)

How to use AI to generate an adult coloring book using the Hasdx model and an upscaler

·

10 min read

Adult coloring books offer a relaxing, meditative way to unwind that has soared in popularity in recent years. But the selection in stores tends to focus on generic patterns and shapes. And, if you have your own idea for some interesting content, you don't have an easy way to make your own coloring book say, for your friends, unless you're willing to hire an artist or create each detailed drawing yourself.

Well, what if I told you there was actually a way around that problem?

Subscribe or follow me on Twitter for more content like this!

Turns out there is. New AI image generation models like DALL-E 2, Midjourney, and Stable Diffusion provide an easy way to create endless unique adult coloring book pages personalized to any theme or interest. With the right model (or chain of models... more on that later) and the right prompt, you can get perfectly detailed images for your coloring book idea.

In this article, we’ll explore how to leverage the power of AI to make custom coloring books adults will love. We'll take a close look at the Hasdx model for this application, explore some example prompts, study the model's inputs and outputs, play around with it using a web UI, and see how we can couple it with an upscaler like Real-ESRGAN, GFPGAN, or Codeformer to get even better results. We'll also see how we can modify the prompt to vary the level of complexity in the image, effectively tailoring our model to the skill level of the adult (or child) who happens to be holding the crayons. Let's get going.

Example Hasdx image generation.

An example image we'll create in this guide.

Overview and intro to Hasdx

Recent AI models like DALL-E 2, Midjourney, and Stable Diffusion use various AI techniques to generate remarkably realistic and diverse images from text prompts. They are trained on huge datasets of images and text to "learn" associations between words and visual concepts. By entering the right prompt, you can guide these models to create custom illustrations suitable for coloring books.

For our adult coloring book project, we will use Hasdx (originally on Civitai). We'll look specifically at an implementation of Hasdx created by cjwbw and hosted on Replicate. I chose Hasdx specifically because it is a fine-tuned version of Stable Diffusion, allowing it to produce high-quality, varied images perfect for coloring books.

Example hasdx generation

Image generated from the prompt: adult coloring book, delicate flowers, intricate details, advanced patterns, black and white. Generated using the hasdx implementation on patience.ai.

How was Hasdx developed? Why use it?

Stable Diffusion, developed through a collaboration between academic researchers and non-profit organizations, sparked a revolution in AI image generation. As creators began experimenting with Stable Diffusion, specialized models emerged seeking to enhance aspects like image quality and training control.

One such model was the HuggingFace Vintedois Diffusion V0 1 model by creator 22h, also available on Replicate. By fine-tuning Stable Diffusion on a diverse dataset, 22h developed a versatile general-purpose model skilled at detailed image generation.

Around the same period, two checkpoint models gained recognition for their artistic capabilities - sxd-berrymix-merge and handas-3dkx10b. Sxd-berrymix-merge, made by AI artist EMAD, combined earlier Stable Diffusion checkpoints and applied additional precision training focused on improving facial features, lighting, and color realism. As a result, it excels at photorealistic human images. Meanwhile, handas-3dkx10b, created by digital artist handas2077, employed 3D modeling techniques to achieve exceptional accuracy and detail.

Identifying an opportunity for synergy, developer bestjammer merged these models. By combining Vintedois Diffusion's versatility with sxd-berrymix-merge's portrait talents and handas-3dkx10b's precision, bestjammer created Hasdx - a 7.2 GB model balancing general capability with specialized artistry.

Unlike its complex predecessors, Hasdx emphasized simplicity, flexibility, and high-fidelity results. This made it appealing for creative applications like generating adult coloring book illustrations, where intricate designs can benefit from Hasdx's detail without requiring lengthy prompts. For users across skill levels, Hasdx brought professional-grade image generation within reach.

How to interact with Hasdx using the Replicate demo UI

If you'd like to follow along with the steps in this guide and try your hand at generating an adult coloring book image with Hasdx alongside me, the fastest and simplest way to get started is to use to Replicate demo UI. Here's how to access it:

  • Head to the model details page for Hasdx on AImodels.fyi

  • In the column on the right, find the Replicate demo link ("Model Link" -> "View on Replicate")

  • Create a Replicate account and choose the "Demo" tab on the Hasdx page

  • Interact directly with the prompt fields as needed and click "generate" to test your inputs.

You can also read more about how to interact with the model in the complete Hasdx model guide.

Hasdx inputs and outputs

When using Hasdx for an adult coloring book project, there are a few key inputs you can adjust. We'll focus on the prompt in the next section, but to be thorough, here's a list of all of the parameters you can play around with.

  • prompt - This is where you provide the text prompt describing what you want the AI to generate. For an adult book, focus on themes and intricate details.

  • negative_prompt - Specify anything you want the image to avoid, like text or distracting background objects.

  • width/height - Hasdx works best at high resolutions like 768x768. Higher sizes capture more detail.

  • num_inference_steps - Around 80 steps render details nicely without taking too long.

  • guidance_scale - Keep this high, like 9-10, so outputs adhere closely to the prompt.

  • seed - Change the seed to get variation between otherwise identical prompts.

The key outputs from Hasdx will be high-resolution PNG images matching the prompt details. With the right prompts (shown below), the AI will generate sharp, intricate illustrations perfect for printable adult coloring book pages. If you're using Replicate to interact with the model (as we will be doing in this example), the output will look like this:

{
  "type": "array",
  "items": {
    "type": "string",
    "format": "uri"
  },
  "title": "Output"
}

Crafting the Prompt

The key to generating great images with AI is carefully crafting the text prompt. For coloring books, we want simple black-and-white line drawings with thick outlines. Here is a prompt structure that works well, inspired by Chase Lean's twitter thread on how to create children's book drawings using Midjourney.

adult coloring book, cartoon, [theme], intricate details, advanced patterns, black and white

Replace [theme] with whatever you want to illustrate - animals, vehicles, foods etc. Let's try some examples:

  • adult coloring book, cartoon, delicate flowers, intricate details, advanced patterns, black and white

  • adult coloring book, cartoon, beautiful warrior, intricate details, advanced patterns, black and white

  • adult coloring book, cartoon, art deco buildings, intricate details, advanced patterns, black and white

You'll also gain a lot by setting a negative prompt. Here's the one I used:

  • color, photo, fax, screenshot, border, blurry, grainy

You can set the other parameters I reviewed above. Here's a full example that I think has a very nice output.

  • Prompt: adult coloring book, cartoon, beautiful warrior, intricate details, advanced patterns, black and white

  • Negative prompt: photo, fax, screenshot, border, blurry, grainy

  • Width: 512

  • Height: 512

  • Number of Outputs: 1

  • Number of Inference Steps: 185

  • Guidance Scale: 12

  • Scheduler: DPMSolverMultistep

  • Seed: none (blank)

Example hasdx generation. Prompt: adult coloring book, cartoon, beautiful warrior, intricate details, advanced patterns, black and white

Adjusting the complexity

We can also adjust the complexity of the generated images. For adult books, intricate details and advanced patterns are preferred. Children's books, on the other hand, usually favor simpler images due to the fine motor skill level of their readers.

To make more basic illustrations for simpler children's books, consider changing the prompt to have elements that call out simpler styles:

b/w outline art for kids coloring book page, rabbit, Kids coloring pages, full white, kids style, white background, whole body, Sketch style, full body (((((white background))))), only use outline. , cartoon style, line art, coloring book, clean line art, white background, Sketch style

Original prompt from prompthero

Hasdx generation from the prompt: b/w outline art for kids coloring book page, rabbit, Kids coloring pages, full white, kids style, white background, whole body, Sketch style, full body (((((white background))))), only use outline. , cartoon style, line art, coloring book, clean line art, white background, Sketch style

Example: simple Hasdx generation using the prompt shown above. Cute bunny!

Experiment with different style values to get the right level of detail. But remember, most adults enjoy advanced complexity.

Upscaling the image

You may find the resulting image generated by Hasdx a little blurry, especially if you need to scale it up to be larger for a book you'd ultimately like to print.

Fortunately, you can run your outputs through another model to get an even better file. These models are called upscalers, and there are many popular options:

Here's an example that shows how running the first example output through Real-ESRGAN results in a better-quality image:

Example upscale using Real-ESRGAN

Initial image (left) and upscaled image (right) using Real-ESRGAN

The results are pretty subtle, but once you see the upscaled image and original side-by-side, you can see how the improved lines make coloring the image easier - fewer gray areas and sharper boundaries are great for this type of application.

Generating a Complete Book

Once you've perfected your prompts and practiced upscaling images, you're basically all set. You can now generate the full set of illustrations for your book by following this general process:

  • Make a list of themes and topics you want to include.

  • Craft a prompt for each one using the formula above, adjusting the style as needed. Consider using a seed to keep styles consistent.

  • Refine any illustrations that don't have enough detail. Use an upscaler to enhance them.

  • Arrange the final images into printable pages using publishing software.

And that's it - you now have a custom AI-generated adult coloring book! The enormous range of intricately detailed images these models can create makes it easy to tailor the book to any style and subject matter.

Conclusion

Using AI to create custom adult coloring books is an exciting new application of generative image models. As we've seen, tools like Hasdx provide an endless source of unique, intricate illustrations to make highly personalized books.

Here are some of the big takeaways after walking through this full process:

  • Recent AI models like Stable Diffusion enable generating custom images through carefully crafted text prompts. Fine-tuning produces specialized models like Hasdx tailored for specific creative needs.

  • Hasdx balances general capabilities with a focus on realism and detail. This makes it well-suited for detailed adult coloring book images.

  • The prompt structure gives you precise control over the theme and complexity of the generated illustrations. Negative prompts help avoid undesirable elements.

  • Running Hasdx outputs through upscaling models improves quality for printing. ESRGAN and others sharpen details and lines.

  • The enormous range of possible illustrations makes custom books easy to tailor to individual styles and interests.

  • AI looks poised to become a game-changer in enabling creators to make unique coloring books and other personalized image-based products.

The world of generative AI is rapidly evolving. As models continue to improve in capability and accessibility, we're likely to see many more emerging applications like custom adult coloring books. The future looks bright for leveraging AI creativity! Thanks for reading.

Subscribe or follow me on Twitter for more content like this!

Resources and further reading

Here are some helpful resources that you may want to take a look at as you work on your AI-based adult coloring book project:

Did you find this article valuable?

Support Mike Young by becoming a sponsor. Any amount is appreciated!