跳到主要内容

ASCII 艺术

使用 pyfiglet(571 种字体)、cowsay、boxes、toilet、image-to-ascii、远程 API(asciified、ascii.co.uk)以及 LLM 回退方案生成 ASCII 艺术。无需 API 密钥。

技能元数据

来源捆绑(默认安装)
路径skills/creative/ascii-art
版本4.0.0
作者0xbyt4, Hermes Agent
许可证MIT
标签ASCII, Art, Banners, Creative, Unicode, Text-Art, pyfiglet, figlet, cowsay, boxes
相关技能excalidraw

参考:完整 SKILL.md

信息

以下是 Hermes 在触发此技能时加载的完整技能定义。这是技能激活时代理看到的指令。

ASCII 艺术技能

多种工具满足不同的 ASCII 艺术需求。所有工具均为本地 CLI 程序或免费 REST API — 无需 API 密钥。

工具 1:文本横幅(pyfiglet — 本地)

将文本渲染为大型 ASCII 艺术横幅。内置 571 种字体。

设置

pip install pyfiglet --break-system-packages -q

用法

python3 -m pyfiglet "YOUR TEXT" -f slant
python3 -m pyfiglet "TEXT" -f doom -w 80 # Set width
python3 -m pyfiglet --list_fonts # List all 571 fonts
风格字体最佳用途
简洁现代slant项目名称、标题
粗体块状doom标题、Logo
大而清晰big横幅
经典横幅banner3宽屏显示
紧凑small副标题
赛博朋克cyberlarge科技主题
3D 效果3-d启动画面
哥特式gothic戏剧性文本

提示

  • 预览 2-3 种字体,让用户选择他们最喜欢的
  • 短文本(1-8 个字符)最适合使用 doomblock 等细节丰富的字体
  • 长文本更适合使用 smallmini 等紧凑字体

工具 2:文本横幅(asciified API — 远程,无需安装)

免费 REST API,可将文本转换为 ASCII 艺术。提供 250+ 种 FIGlet 字体。直接返回纯文本 — 无需解析。当未安装 pyfiglet 或作为快速替代方案时使用此工具。

用法(通过终端 curl)

# Basic text banner (default font)
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello+World"

# With a specific font
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Slant"
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Doom"
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Star+Wars"
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=3-D"
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=Hello&font=Banner3"

# List all available fonts (returns JSON array)
curl -s "https://asciified.thelicato.io/api/v2/fonts"

提示

  • 在 text 参数中将空格 URL 编码为 +
  • 响应为纯文本 ASCII 艺术 — 无 JSON 包装,可直接显示
  • 字体名称区分大小写;使用 fonts 端点获取确切名称
  • 适用于任何装有 curl 的终端 — 无需 Python 或 pip

工具 3:Cowsay(消息艺术)

经典工具,用 ASCII 角色和对话气泡包裹文本。

设置

sudo apt install cowsay -y    # Debian/Ubuntu
# brew install cowsay # macOS

用法

cowsay "Hello World"
cowsay -f tux "Linux rules" # Tux the penguin
cowsay -f dragon "Rawr!" # Dragon
cowsay -f stegosaurus "Roar!" # Stegosaurus
cowthink "Hmm..." # Thought bubble
cowsay -l # List all characters

可用角色(50+)

beavis.zen, bong, bunny, cheese, daemon, default, dragon, dragon-and-cow, elephant, eyes, flaming-skull, ghostbusters, hellokitty, kiss, kitty, koala, luke-koala, mech-and-cow, meow, moofasa, moose, ren, sheep, skeleton, small, stegosaurus, stimpy, supermilker, surgery, three-eyes, turkey, turtle, tux, udder, vader, vader-koala, www

眼睛/舌头修饰符

cowsay -b "Borg"       # =_= eyes
cowsay -d "Dead" # x_x eyes
cowsay -g "Greedy" # $_$ eyes
cowsay -p "Paranoid" # @_@ eyes
cowsay -s "Stoned" # *_* eyes
cowsay -w "Wired" # O_O eyes
cowsay -e "OO" "Msg" # Custom eyes
cowsay -T "U " "Msg" # Custom tongue

工具 4:Boxes(装饰边框)

在任何文本周围绘制装饰性 ASCII 艺术边框/框架。内置 70+ 种设计。

设置

sudo apt install boxes -y    # Debian/Ubuntu
# brew install boxes # macOS

用法

echo "Hello World" | boxes                    # Default box
echo "Hello World" | boxes -d stone # Stone border
echo "Hello World" | boxes -d parchment # Parchment scroll
echo "Hello World" | boxes -d cat # Cat border
echo "Hello World" | boxes -d dog # Dog border
echo "Hello World" | boxes -d unicornsay # Unicorn
echo "Hello World" | boxes -d diamonds # Diamond pattern
echo "Hello World" | boxes -d c-cmt # C-style comment
echo "Hello World" | boxes -d html-cmt # HTML comment
echo "Hello World" | boxes -a c # Center text
boxes -l # List all 70+ designs

与 pyfiglet 或 asciified 结合使用

python3 -m pyfiglet "HERMES" -f slant | boxes -d stone
# Or without pyfiglet installed:
curl -s "https://asciified.thelicato.io/api/v2/ascii?text=HERMES&font=Slant" | boxes -d stone

工具 5:TOIlet(彩色文本艺术)

类似 pyfiglet,但带有 ANSI 颜色效果和视觉过滤器。非常适合终端视觉美化。

设置

sudo apt install toilet toilet-fonts -y    # Debian/Ubuntu
# brew install toilet # macOS

用法

toilet "Hello World"                    # Basic text art
toilet -f bigmono12 "Hello" # Specific font
toilet --gay "Rainbow!" # Rainbow coloring
toilet --metal "Metal!" # Metallic effect
toilet -F border "Bordered" # Add border
toilet -F border --gay "Fancy!" # Combined effects
toilet -f pagga "Block" # Block-style font (unique to toilet)
toilet -F list # List available filters

过滤器

crop, gay(彩虹), metal, flip, flop, 180, left, right, border

注意:toilet 输出用于颜色的 ANSI 转义码 — 在终端中有效,但可能无法在所有上下文中渲染(例如,纯文本文件、某些聊天平台)。

工具 6:图像转 ASCII 艺术

将图像(PNG、JPEG、GIF、WEBP)转换为 ASCII 艺术。

# Install
sudo snap install ascii-image-converter
# OR: go install github.com/TheZoraiz/ascii-image-converter@latest
ascii-image-converter image.png                  # Basic
ascii-image-converter image.png -C # Color output
ascii-image-converter image.png -d 60,30 # Set dimensions
ascii-image-converter image.png -b # Braille characters
ascii-image-converter image.png -n # Negative/inverted
ascii-image-converter https://url/image.jpg # Direct URL
ascii-image-converter image.png --save-txt out # Save as text

选项 B:jp2a(轻量级,仅支持 JPEG)

sudo apt install jp2a -y
jp2a --width=80 image.jpg
jp2a --colors image.jpg # Colorized

工具 7:搜索预制 ASCII 艺术

从网络搜索精选的 ASCII 艺术。使用带有 curlterminal

大型经典 ASCII 艺术收藏库,按主题分类。艺术内容位于 HTML <pre> tags. Fetch the page with curl, then extract art with a small Python snippet.

URL pattern: https://ascii.co.uk/art/{subject}

Step 1 — Fetch the page:

curl -s 'https://ascii.co.uk/art/cat' -o /tmp/ascii_art.html

Step 2 — Extract art from pre tags:

import re, html
with open('/tmp/ascii_art.html') as f:
text = f.read()
arts = re.findall(r'<pre[^>]*>(.*?)</pre>', text, re.DOTALL)
for art in arts:
clean = re.sub(r'<[^>]+>', '', art)
clean = html.unescape(clean).strip()
if len(clean) > 30:
print(clean)
print('\n---\n')

Available subjects (use as URL path):

  • Animals: cat, dog, horse, bird, fish, dragon, snake, rabbit, elephant, dolphin, butterfly, owl, wolf, bear, penguin, turtle
  • Objects: car, ship, airplane, rocket, guitar, computer, coffee, beer, cake, house, castle, sword, crown, key
  • Nature: tree, flower, sun, moon, star, mountain, ocean, rainbow
  • Characters: skull, robot, angel, wizard, pirate, ninja, alien
  • Holidays: christmas, halloween, valentine

Tips:

  • Preserve artist signatures/initials — important etiquette
  • Multiple art pieces per page — pick the best one for the user
  • Works reliably via curl, no JavaScript needed

Source B: GitHub Octocat API (fun easter egg)

Returns a random GitHub Octocat with a wise quote. No auth needed.

curl -s https://api.github.com/octocat

Tool 8: Fun ASCII Utilities (via curl)

These free services return ASCII art directly — great for fun extras.

QR Codes as ASCII Art

curl -s "qrenco.de/Hello+World"
curl -s "qrenco.de/https://example.com"

Weather as ASCII Art

curl -s "wttr.in/London"          # 带有 ASCII 图形的完整天气报告
curl -s "wttr.in/Moon" # ASCII 艺术月相
curl -s "v2.wttr.in/London" # 详细版本

工具 9:LLM 生成的自定义艺术(回退方案)

当上述工具无法满足需求时,直接使用以下 Unicode 字符生成 ASCII 艺术:

字符调色板

制表符: ╔ ╗ ╚ ╝ ║ ═ ╠ ╣ ╦ ╩ ╬ ┌ ┐ └ ┘ │ ─ ├ ┤ ┬ ┴ ┼ ╭ ╮ ╰ ╯

块元素: ░ ▒ ▓ █ ▄ ▀ ▌ ▐ ▖ ▗ ▘ ▝ ▚ ▞

几何图形与符号: ◆ ◇ ◈ ● ○ ◉ ■ □ ▲ △ ▼ ▽ ★ ☆ ✦ ✧ ◀ ▶ ◁ ▷ ⬡ ⬢ ⌂

规则

  • 最大宽度:每行 60 个字符(终端安全)
  • 最大高度:横幅为 15 行,场景为 25 行
  • 仅使用等宽字体:输出必须在固定宽度字体中正确渲染

决策流程

  1. 将文本作为横幅 → 如果已安装 pyfiglet,则使用它;否则通过 curl 调用 asciified API
  2. 用有趣的字符艺术包装消息 → cowsay
  3. 添加装饰性边框/框架 → boxes(可与 pyfiglet/asciified 结合使用)
  4. 特定事物的艺术形象(猫、火箭、龙)→ 通过 curl 调用 ascii.co.uk 并解析
  5. 将图像转换为 ASCII → ascii-image-converter 或 jp2a
  6. 二维码 → 通过 curl 调用 qrenco.de
  7. 天气/月亮艺术 → 通过 curl 调用 wttr.in
  8. 自定义/创意内容 → 使用 Unicode 调色板通过 LLM 生成
  9. 任何未安装的工具 → 安装它,或回退到下一个选项