create-svg-from-prompt
Scannednpx machina-cli add skill aiskillstore/marketplace/create-svg-from-prompt --openclawSetup
if autotrace is not available in the environment, then install it with the following command:
sudo apt update
sudo apt install git build-essential intltool imagemagick libmagickcore-dev pstoedit libpstoedit-dev autopoint
git clone https://github.com/autotrace/autotrace.git
cd autotrace
./autogen.sh
LD_LIBRARY_PATH=/usr/local/lib ./configure --prefix=/usr
make
sudo make install
Core Workflow
When the user prompts the model to generate an SVG of and image or scene:
User wants an SVG of an image or scene
To generate an SVG of an image or scene use Google Gemini and autotrace:
curl -s -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image:generateContent" -H "x-goog-api-key: <GEMINI_API_KEY>" -H "Content-Type: application/json" -d '{ "contents": [{ "parts": [ {"text": "<IMAGE_PROMPT>"}]}]}' | grep -o '"data": "[^"]*"' | cut -d'"' -f4 | base64 --decode | autotrace -output-format svg -despeckle-level 10 -despeckle-tightness 2.0 -output-file <OUTPUT_FILE>.svg
Arguments from prompt:
<GEMINI_API_KEY>: The Gemini API key gotten from the environment variable "GEMINI_API_KEY"<IMAGE_PROMPT>: The user's initial prompt modified to change phrases like "Generate an svg" to "Generate an image." Do not modify the rest of the prompt or add any extra instructions or descriptions.<OUTPUT_FILE>: An 8-30 character filename based on the image the user wants
Source
git clone https://github.com/aiskillstore/marketplace/blob/main/skills/0x6a77/create-svg-from-prompt/SKILL.mdView on GitHub Overview
This skill generates an SVG of a user-described image or scene by converting a text prompt into a raster image with Google Gemini and then tracing it with autotrace. It relies on an autotrace-enabled environment and a curl workflow to fetch, decode, and convert the image to SVG, outputting a file named by the user within 8-30 characters.
How This Skill Works
A user provides an image prompt. The system sends the prompt to Gemini to generate a raster image, decodes the base64 data, and pipes it into autotrace to produce an SVG. The workflow requires a GEMINI_API_KEY and an OUTPUT_FILE (8-30 chars); the prompt must be adjusted to say Generate an image instead of Generate an svg, while preserving the rest of the prompt.
When to Use It
- You need a scalable vector version of a described scene or object for web or print.
- Rapidly prototyping vector icons or simple illustrations from natural-language prompts.
- Converting a raster concept into a clean, editable SVG for UI components.
- Creating SVG assets for dashboards or apps from descriptive prompts.
- Generating stylized or schematic SVG art from narrative prompts.
Quick Start
- Step 1: Install autotrace and dependencies as shown in Setup.
- Step 2: Prepare your prompt and choose an 8-30 character OUTPUT_FILE name.
- Step 3: Run the curl command with your GEMINI_API_KEY, a prompt modified to 'Generate an image', and your OUTPUT_FILE; access <OUTPUT_FILE>.svg when finished.
Best Practices
- Write clear prompts describing composition, colors, style, and level of detail.
- Ensure autotrace and all dependencies are installed before running the workflow.
- Use the exact prompt modification: replace 'Generate an svg' with 'Generate an image' in the IMAGE_PROMPT.
- Choose an OUTPUT_FILE name that is 8-30 characters long and descriptive of the image.
- Review and adjust despeckle and tightness settings if the SVG has stray artifacts.
Example Use Cases
- Prompt: A minimalist seaside landscape with sunset, vector-style
- Prompt: A flat-design shopping cart icon in blue and white
- Prompt: A retro rocket ship in a simple line art vector
- Prompt: A coffee cup on a saucer with steam, clean iconography
- Prompt: A city skyline at night in geometric shapes