当前位置: 首页 > news >正文

学会使用ai作图

UPDATE

发现一个爆赞的github项目,作图比生成svg好用很多:

https://github.com/mermaid-js/mermaid

SVG

即可缩放矢量图形(Scalable Vector Graphics),是一种基于可扩展标记语言(XML)的矢量图形格式。用代码描述矢量图形,你可以把它理解成“用文字画图”。和常见的JPG、PNG等位图完全不同,天生为网页而生,可玩性更高一些。

<svg width="200" height="100" xmlns="http://www.w3.org/2000/svg"><rect x="50" y="20" width="100" height="60" fill="red" />
</svg>

对于一个svg的样式,可以内嵌html显示或者用浏览器直接打开编辑好的.svg文件,所以这里让ai直接生成完整的svg代码来实现用户良好的图像。

AI prompt

根据要求绘制各种图片,如流程图等
以SVG形式给出
你的绘图遵循以下原则
1. 尽量美观,配色简洁舒适
2. 保证局部的对称和居中,尤其是箭头以及箭头上的文字
3. 不要使用曲线
你的背景可以参考这个:
<!-- 渐变背景 -->
<defs>
<linearGradient id="bgGradient" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#f8f9fa;stop-opacity:1" />
<stop offset="100%" style="stop-color:#e9ecef;stop-opacity:1" />
</linearGradient>
<linearGradient id="stackGradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" style="stop-color:#e9f2ff;stop-opacity:1" />
<stop offset="100%" style="stop-color:#d7e5f5;stop-opacity:1" />
</linearGradient>
<filter id="shadow" x="-10%" y="-10%" width="120%" height="120%">
<feDropShadow dx="3" dy="3" stdDeviation="3" flood-opacity="0.2"/>
</filter>
<!-- 定义箭头 -->
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#495057" />
</marker>
</defs>

示例

  1. 任务
我需要了解mysql主从复制架构完整流程,需要有详细的文字介绍根据要求绘制各种图片,如流程图等
以SVG形式给出
你的绘图遵循以下原则
1. 尽量美观,配色简洁舒适
2. 保证局部的对称和居中,尤其是箭头以及箭头上的文字
3.不要使用曲线
你的背景可以参考这个:
<!-- 渐变背景 -->
<defs>
<linearGradient id="bgGradient" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#f8f9fa;stop-opacity:1" />
<stop offset="100%" style="stop-color:#e9ecef;stop-opacity:1" />
</linearGradient>
<linearGradient id="stackGradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" style="stop-color:#e9f2ff;stop-opacity:1" />
<stop offset="100%" style="stop-color:#d7e5f5;stop-opacity:1" />
</linearGradient>
<filter id="shadow" x="-10%" y="-10%" width="120%" height="120%">
<feDropShadow dx="3" dy="3" stdDeviation="3" flood-opacity="0.2"/>
</filter>
<!-- 定义箭头 -->
<marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto">
<polygon points="0 0, 10 3.5, 0 7" fill="#495057" />
</marker>
</defs>
  1. 根据ai生成的svg代码进行预览
    这里可以用一些在线的svg解析网站或者自己保存为svg文件预览。
    生成代码如下:
<svg width="800" height="600" viewBox="0 0 800 600" xmlns="http://www.w3.org/2000/svg"><!-- 引用用户提供的渐变和箭头定义 --><defs><linearGradient id="bgGradient" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:#f8f9fa;stop-opacity:1" /><stop offset="100%" style="stop-color:#e9ecef;stop-opacity:1" /></linearGradient><marker id="arrowhead" markerWidth="10" markerHeight="7" refX="9" refY="3.5" orient="auto"><polygon points="0 0, 10 3.5, 0 7" fill="#495057" /></marker></defs><!-- 背景 --><rect width="100%" height="100%" fill="url(#bgGradient)" /><!-- 主库组件 --><g transform="translate(100, 150)"><rect x="0" y="0" width="200" height="300" rx="10" fill="#fff" filter="url(#shadow)" /><text x="100" y="30" text-anchor="middle" font-size="16" fill="#2d3436">Master</text><rect x="20" y="60" width="160" height="40" fill="#e9f2ff" rx="5" /><text x="100" y="85" text-anchor="middle" font-size="14">Binlog</text><rect x="20" y="120" width="160" height="40" fill="#d7e5f5" rx="5" /><text x="100" y="145" text-anchor="middle" font-size="14">Binlog Dump线程</text></g><!-- 从库组件 --><g transform="translate(500, 150)"><rect x="0" y="0" width="200" height="300" rx="10" fill="#fff" filter="url(#shadow)" /><text x="100" y="30" text-anchor="middle" font-size="16" fill="#2d3436">Slave</text><rect x="20" y="60" width="160" height="40" fill="#e9f2ff" rx="5" /><text x="100" y="85" text-anchor="middle" font-size="14">Relay Log</text><rect x="20" y="120" width="160" height="40" fill="#d7e5f5" rx="5" /><text x="100" y="145" text-anchor="middle" font-size="14">I/O线程</text><rect x="20" y="180" width="160" height="40" fill="#d7e5f5" rx="5" /><text x="100" y="205" text-anchor="middle" font-size="14">SQL线程</text></g><!-- 箭头与流程标签 --><path d="M300 200 L500 200" stroke="#495057" stroke-width="2" marker-end="url(#arrowhead)" /><text x="400" y="190" text-anchor="middle" font-size="12" fill="#495057">Binlog事件传输</text><path d="M300 250 L500 250" stroke="#495057" stroke-width="2" marker-end="url(#arrowhead)" /><text x="400" y="240" text-anchor="middle" font-size="12" fill="#495057">ACK确认(半同步)</text>
</svg>
  1. 示例图片如下
    在这里插入图片描述

相关文章:

  • c++在头文件中声明全局的变量
  • TNNLS-2020《Autoencoder Constrained Clustering With Adaptive Neighbors》
  • Deep Learning(手写字识别 - CNN)
  • 阿里的库存秒杀实现与Inventory Hint技术解析
  • Python 接入DeepSeek
  • 高等数学第七章---微分方程(§7.1-§7.3微分方程概念、一阶微分方程、一阶微分线性方程)
  • 生成式人工智能认证(GAI认证)官网 - 全国统一认证中文服务平台上线
  • 一种资源有限单片机处理cJSON数据的方法
  • WordPress 文章和页面:它们的区别是什么?
  • Qt 的.pro文件配置详解
  • 让 Cursor 教我写 MCP Client
  • Qt for Android编译报错解决 -------- Connection reset
  • 编程技能:字符串函数04,直接使用 strcpy,解决报错
  • C#上位机RS485通信控制变频器
  • CodeBuddy Craft,我的编程搭子
  • 股指期货套期保值怎么操作?
  • python: *args 与 **kwargs 用法
  • 从零实现一个高并发内存池 - 2
  • 【软件测试】第二章·软件测试的基本概念
  • 牛客——签到题
  • 国防部:菲方应停止一切侵权挑衅危险举动,否则只会自食苦果
  • 人民日报:从“轻微免罚”看涉企执法方式转变
  • 晋级四强!WTA1000罗马站:郑钦文2比0萨巴伦卡
  • 深圳中院回应“退休夫妻月入1.2万负债1.2亿”:其自述因经营不善负债
  • 为惩戒“工贼”,美国编剧工会“痛下杀手”
  • 俄土外长通话讨论俄乌谈判问题