Using Hasdx to create an AI-generated adult coloring book (includes prompts!)
Tags: beginners, tutorial, ai, learning
Published: 2023-08-02 21:05:19

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?

<iframe src="https://aimodels.substack.com/embed" width="100%" height="auto" style="box-sizing:border-box;border:0px;display:block;overflow:hidden;width:720px;grid-column:main-start / main-end;margin-bottom:0px;margin-top:calc(1.6em*var(--content-spacing-multiplier, 1));color:rgb(21, 23, 26);font-family:Inter, -apple-system, "system-ui", "Segoe UI", Helvetica, Arial, sans-serif;font-size:18px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;orphans:2;text-align:start;text-indent:0px;text-transform:none;widows:2;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgb(255, 255, 255);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial"></iframe>

[*Subscribe*](https://aimodels.substack.com/) *or follow me on* [*Twitter*](https://twitter.com/mikeyoung44) *for more content like this!*

Turns out there is. New AI image generation models like [DALL-E 2](https://openai.com/dall-e-2/), [Midjourney](https://www.midjourney.com/home/), and [Stable Diffusion](https://github.com/CompVis/stable-diffusion#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](https://www.aimodels.fyi/models/replicate/43110cc8-909e-4a18-aa29-74073e13b7ee) 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.](https://notes.aimodels.fyi/content/images/2023/08/output--1--2.png align="left")

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](https://civitai.com/models/3758/hasdx) (originally on Civitai). We'll look specifically at an implementation of Hasdx created by [cjwbw](https://www.aimodels.fyi/creators/huggingFace/cjwbw) and hosted on [Replicate](https://replicate.com/). 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](https://notes.aimodels.fyi/content/images/2023/08/adult-coloring-book-delicate-flowers-intricate-details-advanced-patterns-black-and-white-487519.png align="left")

Image generated from the prompt: adult coloring book, delicate flowers, intricate details, advanced patterns, black and white. Generated using the [hasdx implementation on](https://www.patience.ai/models/hasdx) [patience.ai](http://patience.ai).

## How was Hasdx developed? Why use it?

[Stable Diffusion](https://github.com/CompVis/stable-diffusion#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](https://www.aimodels.fyi/models/huggingFace/275b77ab-1541-4600-be92-37764d746f6d) model by creator [22h](https://www.aimodels.fyi/creators/huggingFace/22h), also available on [Replicate](https://www.aimodels.fyi/models/replicate/bbc2858a-01f8-4b0e-bbb6-52b74ff99130). 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](https://civitai.com/models/1349/sxd-berrymix-merge) and [handas-3dkx10b](https://civitai.com/models/2504/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](https://www.aimodels.fyi/creators/huggingFace/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](https://www.aimodels.fyi/models/replicate/43110cc8-909e-4a18-aa29-74073e13b7ee) on [AImodels.fyi](http://AImodels.fyi)
    
* In the column on the right, find the Replicate demo link (**"Model Link" -&gt; "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](https://notes.aimodels.fyi/unveiling-the-magic-of-hasdx-a-comprehensive-guide-to-mixed-stable-diffusion-models/).

## 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:

```json
{
  "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](https://twitter.com/chaseleantj/status/1686596103305928705) on how to create children's book drawings using Midjourney.

```javascript
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)
    

![](https://notes.aimodels.fyi/content/images/2023/08/out-0--3-.png align="left")

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](https://prompthero.com/prompt/dfefc058da8) to have elements that call out simpler styles:

```javascript
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](https://prompthero.com/prompt/dfefc058da8)

![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](https://notes.aimodels.fyi/content/images/2023/08/out-0--4-.png align="left")

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:

* [**ESRGAN**](https://www.aimodels.fyi/models/replicate/c8f4e3b6-5972-4bbc-a2ac-2db464654ea3): Offers outstanding results for ideal simulated degradation. This model would work well for restoring synthetic images like the ones we're creating with Hasdx.
    
* [**Real-ESRGAN**](https://www.aimodels.fyi/models/replicate/78874a62-254d-48a1-b4aa-ef6a26ea7651): Tailored to tackle real-world corruptions, but still capable of cleaning up synthetic images [just like the older ESRGAN model](https://notes.aimodels.fyi/esrgan-vs-real-esrgan-from-theoretical-to-real-world-super-resolution-with-ai/).
    
* [**Codeformer:**](https://www.aimodels.fyi/models/replicate/f3e540cd-400b-4594-b11b-280f45a62722) A robust [face restoration algorithm](https://notes.aimodels.fyi/codeformer-fixing-ai-generated-photos-with-style/) designed to work with both old photos and AI-generated faces. Would work well for cleaning up weird artifacts in portrait-type generations for coloring books.
    
* [**GFPGAN**](https://www.aimodels.fyi/models/replicate/464b2ad6-3063-4c5e-a31b-ef167547c5df)**:** [Similar to Codeformer](https://notes.aimodels.fyi/comparing-gfpgan-and-codeformer-a-deep-dive-into-ai-face-restoration/), this model is [good for restoring faces](https://notes.aimodels.fyi/codeformer-fixing-ai-generated-photos-with-style/) and can help us clean up portraits generated as coloring book images.
    

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](https://notes.aimodels.fyi/content/images/2023/08/Screen-Shot-2023-08-02-at-3.42.20-PM.png align="left")

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.

<iframe src="https://aimodels.substack.com/embed" width="100%" height="auto" style="box-sizing:border-box;border:0px;display:block;overflow:hidden;width:720px;grid-column:main-start / main-end;margin-bottom:0px;margin-top:calc(1.6em*var(--content-spacing-multiplier, 1));color:rgb(21, 23, 26);font-family:Inter, -apple-system, "system-ui", "Segoe UI", Helvetica, Arial, sans-serif;font-size:18px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;orphans:2;text-align:start;text-indent:0px;text-transform:none;widows:2;word-spacing:0px;-webkit-text-stroke-width:0px;white-space:normal;background-color:rgb(255, 255, 255);text-decoration-thickness:initial;text-decoration-style:initial;text-decoration-color:initial"></iframe>

[*Subscribe*](https://aimodels.substack.com/) *or follow me on* [*Twitter*](https://twitter.com/mikeyoung44) *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:

* [Hasdx model](https://civitai.com/models/3758/hasdx) - Mixed stable diffusion model optimized for creativity
    
* [Unveiling the Magic of Hasdx](https://notes.aimodels.fyi/unveiling-the-magic-of-hasdx-a-comprehensive-guide-to-mixed-stable-diffusion-models/) - A comprehensive guide to mixed stable diffusion models
    
* [Real-ESRGAN](https://github.com/xinntao/Real-ESRGAN) - AI image upscaling model
    
* [Codeformer](https://github.com/sczhou/CodeFormer) - AI face restoration model
    
* [GFPGAN](https://github.com/TencentARC/GFPGAN) - AI face restoration model
    
* [PromptHero](https://prompthero.com/) - Tool for optimizing text prompts
    
* [Chase Lean's Twitter thread](https://twitter.com/chaseleantj/status/1686596103305928705) - Prompt design tips for midjourney