Stable Diffusion can generate and edit vector images using Vector Studio.
The project page for Vector Studio is located at the following URL.
https://github.com/GeorgLegato/stable-diffusion-webui-vectorstudio
Follow the installation instructions on that page, and do not forget to follow the steps for adding the potrace program to the extensions/stable-diffusion-webui-vectorstudio/bin directory.
Vector Studio adds a new tab “Vector Studio” to the Stable Diffusion Automatic1111 Web UI. If you click on that tab you will find a Vector Editor has been installed.
You can download additional Checkpoint Models and Loras from sources like Civitai.com or huggingface.co.
For this guide to use Stable Diffusion to generate SVG images we are using the Coloring-Book checkpoint model: https://civitai.com/models/5153/coloring-book
Download this checkpoint model to the appropriate directory for your installation of Stable Diffusion.
Note: Read the details for the models on how to use them. Some models require the ckpt and yaml config files.
You can also use Textual Inversions to refine your image generation. Textual Inversions get installed in the embeddings directory.
Loras may also help with Stable Diffusion image generation. Loras get installed in the models/Lora directory.
Stable Diffusion Generating SVG Images
To generate vector image from text, click on the txt2image tab and scroll down to Script. Select Vector Studio from the drop down list.
Note that in the Vector Studio Script Settings, we have selected “Visual Style: None – prompt only”, we have checked “Enable Vectorizing” and set the Output format to “svg”. We have also checked “White is Opaque” and “Transparent PNG”.
Stable Diffusion generates a PNG file, then uses potrace to convert that image to a SVG file.
For the Prompt we entered: flat color, modern black and white logo of a lion head.
For the Negative Prompt we entered: small, details, intricate, gradient, shadows, blurry, deformed, ugly.
For the model we selected: coloringBook_coloringBook
Stable Diffusion Generating Color SVG Images
We have not found a way to generate color SVG images directly in Stable Diffusion yet. However, you can generate a flat color image using the model checkpoint you get the best results with, and then use the Open Creative Cloud – Image to SVG Tool to convert it.
Stable Diffusion Generating Flat Color Image
To use Stable Diffusion to generate a flat color image, uncheck the Vector Studio script.
For Prompt we entered: flat color, modern multi-color logo of a lion head, brown and yellow and black, on white background.
For Negative Prompt we entered: small, details, intricate, gradient, shadows, blurry, deformed, ugly.
For Seed we entered: 736201470