SVG图像生成器Skill create-svg-from-prompt

这是一个基于AI的图像生成与转换工具。它通过调用Google Gemini大模型,根据用户的文字描述生成图像,并利用autotrace工具将图像自动转换为高质量的SVG矢量格式。该技能适用于快速创建可缩放的矢量图形、图标、插画和简单场景,无需手动绘图,极大地简化了SVG素材的制作流程。关键词:AI图像生成、SVG转换、矢量图形、Gemini API、autotrace、自动化设计、AIGC工具。

AIGC 0 次安装 2 次浏览 更新于 2/28/2026

name: create-svg-from-prompt description: 根据用户提示生成SVG图像或场景

环境设置

如果环境中没有安装 autotrace,请使用以下命令安装:

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

核心工作流程

当用户提示模型生成图像或场景的SVG时:

用户需要图像或场景的SVG

要生成图像或场景的SVG,请使用Google Gemini和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

从提示中提取的参数:

  • <GEMINI_API_KEY>:从环境变量“GEMINI_API_KEY”获取的Gemini API密钥
  • <IMAGE_PROMPT>:修改用户的初始提示,将“生成SVG”等短语改为“生成图像”。不要修改提示的其余部分,也不要添加任何额外的说明或描述。
  • <OUTPUT_FILE>:基于用户想要的图像,生成一个8-30个字符的文件名