Custom Script for Automatics1111 StableDiffusion-WebUI.

Overview

Text to Vectorgraphics

This is a custom script to extend Automatic1111 StableDiffusion WebUI, in order to generate useful SVG or PDF icons given by your prompts.

How it works

It tunes your prompts in that way to create suitable images to be vectorizied by the POTRACE command line tool. The resulting SVG or PDF file is stored next to your png files in output/samples (default).

Examples

prompt PNG SVG
Happy Einstein
Mountainbike Downhill
coffe mug in shape of a heart
Headphones

Screenshot

image

Features

  • New: Added Visual Styles - RadioButtons provided by the script. Edit the script to extend of modify Stuff like Illustration, Tattoo, Anime etc, to save your time finding prompts on your own. If nothing matches, select "None - promp only" and have back full control.

  • New: Linux and Mac support handling POTRACE for you

Installation

Windows

  • Clone or download the txt2vectorgraphics.py file
  • place it into your SD-installtion folder into "scripts"
  • run your webui as usual
  • HINT: Install Microsoft Powertoys for free, and enjoy in your file explorer SVG previews. image

Linux

If you're running under WSL, Ubuntu or another Linux distro you will need to install potrace. Run sudo apt install potrace.

Mac

Run brew install potrace. Ensure potrace is in your PATH so that you could run in simply by calling from a command terminal.

Dependencies, Potrace

At execution time, the script checks if your have

Recommendations

  • Use short prompts, like "Einstein", "Happy Einstein" ...
  • avoid "realistic" attributes
  • Sampling Steps ~40 is my best experience (to reduce noise and avoid details)
  • CFG Scale 10-12
  • Dont restore faces
  • use 512x512 if no special demand on ratio
  • Batch count support (16)
  • Mostly you want to make white parts opaque (see checkbox in the scripts ui)
  • Same for clipping the content to SVG size
Comments
  • Error after image generation - Execution of Protrace failed.

    Error after image generation - Execution of Protrace failed.

    Hello! First of all - really neat script, got some great results on the first run. Thanks for making it! But then, when running it next time this happens:

    To create a public link, set `share=True` in `launch()`.
    100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:07<00:00,  2.53it/s]
    Error completing request███████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.62it/s]
    Arguments: ('Lion', '', 'None', 'None', 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, False, 0.7, 3, False, False, None, '', 'svg', True, True, False, 0.5, 1, '', 0, '', True, False) {}
    Traceback (most recent call last):
      File "C:\Users\joedo\stable-diffusion-webui\scripts\txt2vectorgfx.py", line 78, in run
        fullfn = files[i]
    IndexError: list index out of range
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\Users\joedo\stable-diffusion-webui\modules\ui.py", line 182, in f
        res = list(func(*args, **kwargs))
      File "C:\Users\joedo\stable-diffusion-webui\webui.py", line 69, in f
        res = func(*args, **kwargs)
      File "C:\Users\joedo\stable-diffusion-webui\modules\txt2img.py", line 40, in txt2img
        processed = modules.scripts.scripts_txt2img.run(p, *args)
      File "C:\Users\joedo\stable-diffusion-webui\modules\scripts.py", line 159, in run
        processed = script.run(p, *script_args)
      File "C:\Users\joedo\stable-diffusion-webui\scripts\txt2vectorgfx.py", line 96, in run
        raise Exception("TXT2Vectorgraphics: Execution of Protrace failed, check filesystem, permissions, installation or settings")
    Exception: TXT2Vectorgraphics: Execution of Protrace failed, check filesystem, permissions, installation or settings
    

    potrace.exe is in the scripts directory. In theory nothing has really changed, just having the latest updates from the main repo. Any ideas how to fix this?

    And also - Potrace is named Protrace in several places, as visible in the error message above.

    opened by some9000 10
  • WebUI won't load the script

    WebUI won't load the script

    WebUI spitting out the following error when trying to load script:

    Error loading script: txt2vectorgfx.py Traceback (most recent call last): File "C:\SD\stable-diffusion-webui\modules\scripts.py", line 69, in load_scripts compiled = compile(text, path, 'exec') File "C:\SD\stable-diffusion-webui\scripts\txt2vectorgfx.py", line 68 Txt2Vectorgraphics/txt2vectorgfx.py at 4d89e53528b0a72713fea99b9d6e75ee99919b26 · GeorgLegato/Txt2Vectorgraphics

    opened by delijoe79 2
  • Potracer issue

    Potracer issue

    I'm using your script on a Google Colab but there's an issue with Portrace

    Error completing request
    Arguments: ('mona lisa kurzgesagt style', '', 'None', 'None', 20, 0, False, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 0, 0, 3, False, False, False, None, '', 'Illustration', 'svg', True, True, False, 0.5, True, 16, True, 16, 1, '', 0, '', True, False, False) {}
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/scripts/txt2vectorgfx.py", line 201, in check_Potrace_install
        checkPath = subprocess.Popen(["potrace","-v"])
      File "/usr/lib/python3.7/subprocess.py", line 800, in __init__
        restore_signals, start_new_session)
      File "/usr/lib/python3.7/subprocess.py", line 1551, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'potrace': 'potrace'
    

    I tried running pip install potracer

    pip install potracer
    Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
    Collecting potracer
      Downloading potracer-0.0.4-py2.py3-none-any.whl (24 kB)
    Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from potracer) (1.21.6)
    Installing collected packages: potracer
    Successfully installed potracer-0.0.4
    
    

    But still getting the same error. Any help much appreciated :)

    opened by fredm00n 1
  • Error loading

    Error loading

    Error loading script: txt2vectorgfx (1).py Traceback (most recent call last): File "C:\Users\chlyw\Desktop\Automatic1111\modules\scripts.py", line 69, in load_scripts compiled = compile(text, path, 'exec') File "C:\Users\chlyw\Desktop\Automatic1111\scripts\txt2vectorgfx (1).py", line 70 Txt2Vectorgraphics/txt2vectorgfx.py at main · GeorgLegato/Txt2Vectorgraphics ^ SyntaxError: invalid character '·' (U+00B7)

    opened by bbecausereasonss 1
  • Error thrown when executing

    Error thrown when executing

    File "C:\StableDiffusion\AUTOMATIC1111\scripts\txt2vectorgfx.py", line 84, in run args = [PO_TO_CALL, "-b", poFormat, "-o", fullof, "--blacklevel", format(poThreshold, 'f')] TypeError: unsupported format string passed to dict.format

    Let me know if attaching any logs or anything will help. My wife runs a craft business and half of her work uses svgs for stencils and vinyls, so this would be awesome to get running on my SD machine.

    opened by ciavolella 1
  • potrace.exe issue

    potrace.exe issue

    just mirroring an issue a user had, potrace.exe throwing an error in the folder: https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/1987

    opened by ClashSAN 0
  • Color

    Color

    This may be out of scope for this project, may not be... Assuming I generate cartoons, is there a similar tool for creating SVG images with coloured shapes? I assume a lot of compressing colours and gradients down to solid shapes would need to be done, but even generating something "South Park"-inspired, for example.

    It this tool currently able to do something like this?

    opened by TcNobo 7
Releases(v0.2)
  • v0.2(Oct 13, 2022)

    New

    • Added more internal visual styles, use radio buttons to select
    • Linux and Mac users are on the score board now image

    What's Changed

    • Linux compatability by @TcNobo in https://github.com/GeorgLegato/Txt2Vectorgraphics/pull/1
    • Add tested Mac (M1) support by @noise-puppeteer in https://github.com/GeorgLegato/Txt2Vectorgraphics/pull/4
    • Fix Mac install - propose 'brew install potrace' by @noise-puppeteer in https://github.com/GeorgLegato/Txt2Vectorgraphics/pull/7

    New Contributors

    • @TcNobo made their first contribution in https://github.com/GeorgLegato/Txt2Vectorgraphics/pull/1
    • @noise-puppeteer made their first contribution in https://github.com/GeorgLegato/Txt2Vectorgraphics/pull/4

    Full Changelog: https://github.com/GeorgLegato/Txt2Vectorgraphics/commits/v0.2

    Source code(tar.gz)
    Source code(zip)
Owner
null
A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation

Dynamic Prompt templates A custom script for AUTOMATIC1111/stable-diffusion-webui to implement a tiny template language for random prompt generation.

Adi Eyal 128 Nov 28, 2022
Small script for AUTOMATIC1111/stable-diffusion-webui to create images between two seeds

seed_travel Small script for AUTOMATIC1111/stable-diffusion-webui to create images that exists between seeds. Installation: Copy the file in the scrip

null 117 Nov 11, 2022
Script for AUTOMATIC1111/stable-diffusion-webui to provide a way to quickly add tags from a list to your prompt

tagger Script for AUTOMATIC1111/stable-diffusion-webui to provide a way to quickly add tags from a list to your prompt What it does The script will ad

null 18 Nov 7, 2022
Deforum extention script for AUTOMATIC1111's Stable Diffusion webui

Deforum Stable Diffusion — official extension script for AUTOMATIC1111's webui For now, video-input, 2D, pseudo-2D and 3D animation modes are availabl

deforum 404 Nov 25, 2022
StableDiffusion scripts based on huggingface diffusers.

Yet Another StableDiffusion Implementation Stable Diffusion script(s) based on huggingface diffusers. Comes with extra configurability and some bonus

Kevin L 10 Nov 16, 2022
A local Discord Bot to let Discord users generate images with StableDiffusion, using your GPU

About This is the code of the first version of my Discord bot named "DeguDiffusion", which queue generation requests send by Discord users through an

null 6 Nov 23, 2022
Asymmetric Tiling for stable-diffusion-webui

Asymmetric Tiling for stable-diffusion-webui A custom script for stable-diffusion-webui to configure seamless image tiling independently for the X and

null 28 Nov 9, 2022
A Python script to obfuscate and protect your code through anti debuggers, junk code and custom encryption.

Anubis About | Features | Technologies | Requirements | Starting | License | Author ?? About I was looking around online and github when I realised th

null 88 Nov 25, 2022
Automation CI/CD with Python based script and custom templates (GitlabCI, HelmCharts, ArgoCD)

Automation CI/CD with Python based script (GitOps Approach) Here I tried to automate processes from Gitlab project creation to deployment to the envir

Samir Nabadov 1 Aug 19, 2022
script mult funções desenvolvido em python3 por Ch4rse e Koppy script contem calculadora, scaner de portas, localizador de ip, atualizador de pacotes, painel de consultas gratis, script simples e organizada

TEAM 404 ???? Codigo criado pela 404 ?? Author Ch4rse404 and Koppy CODIGO ?? License APACHE ?? Leng Python 3 ANDROID KALI NETHUNTER TERMUX LINUX KALI

Ch4rse da 404 2 Oct 5, 2022
BloodyAv is Custom Shell Code loader to Bypass Av and Edr.

BloodyAv is Custom Shell Code loader to Bypass Av and Edr.

Mr. niko 6 Apr 2, 2022
Random DNA sequence generator with customizable length and number, and can be filtered by custom mode

DNA-sequence-generator-and-filter for programmable assembly of single-stranded DNA Generation filter for random DNA sequences. The output is unfiltere

Yue Wang 1 Apr 6, 2022
Simple diagnoser for Minecraft resourcepack's broken Custom Model, with quick-fix

Minecraft-Custom-Model-Diagnoser Simple diagnoser for Minecraft resourcepack's broken Custom Model, with quick-fix This program is designed for datapa

WingedSeal 2 Mar 26, 2022
Pearl is a custom Discord bot solution developed within discord.py, an API wrapper written in Python.

About Pearl is a custom Discord bot solution developed within discord.py, an API wrapper written in Python. Inspired from living with a certain feline

Paul Ranshaw 0 Mar 31, 2022
🎥✏️ Add a custom heading at the start of your videos in order to change the default thumbnail

?? ✏️ Add custom heading to videos This script will add a custom heading using FFMPEG at the start of your videos with the objective of changing the d

Sandro Baccega 1 Apr 5, 2022
Extend the scikit-learn classification report with custom weighting schemes

⚖ Weighting Schemes Report Extend the scikit-learn classification report with custom weighting schemes. ?? Usage from weightings_schemes_report import

null 3 Apr 11, 2022
Custom Kubernetes Controller to reload pods automatically if configmaps are changed/ updated. 🔄

k8s-reload Custom Kubernetes Controller to reload pods automatically if configmaps are changed/ updated. ?? k8s-reload Quickstart Install Controller v

Shivansh Thapliyal 2 Jun 26, 2022
This is a custom component to allow control of Fronius Wattpilot wallbox/electro vehicle charging devices in Homeassistant.

Wattpilot Custom Component for homeassistant What This Is: This is a custom component to allow control of Fronius Wattpilot wallbox/electro vehicle ch

null 11 Aug 8, 2022
This is a way to make custom graph on a specific crypto in a currency, for a period with a specific interval. The graph will be automatically send on a discord channel.

discord-bot-cryptocurrency With the use of a discord bot, it will create and send custom graph of : a crypto, in a currency, for a period, with an int

null 2 Jun 12, 2022