欢迎回来

登录 EAKE AI,继续您的智能之旅

忘记密码?
还没有账号?立即注册

ASCII 艺术

ASCII 艺术

ASCII 艺术:pyfiglet、cowsay、boxes、图片转 ASCII

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`标题、标志
大而清晰`big`横幅
经典横幅`banner3`宽屏显示
紧凑`small`副标题
赛博朋克`cyberlarge`科技主题
3D 效果`3-d`启动画面

使用技巧

  • 预览 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 参数中将空格编码为 +
  • 响应为纯文本 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 艺术。

    方案 A:ascii-image-converter(推荐,现代化)

    
    # 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 艺术。使用 terminal 配合 curl

    来源 A:ascii.co.uk(现成艺术推荐)

    按主题整理的大量经典 ASCII 艺术收藏。艺术作品位于 HTML 的

     标签内。使用 curl 获取页面,再用一小段 Python 代码提取艺术内容。

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

    步骤 1——获取页面:

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

    步骤 2——从 pre 标签中提取艺术内容:

    
    import re, html
    with open('/tmp/ascii_art.html') as f:
        text = f.read()
    arts = re.findall(r'
    ]*>(.*?)
    ', 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')

    可用主题(用作 URL 路径):

  • 动物:cat, dog, horse, bird, fish, dragon, snake, rabbit, elephant, dolphin, butterfly, owl, wolf, bear, penguin, turtle
  • 物品:car, ship, airplane, rocket, guitar, computer, coffee, beer, cake, house, castle, sword, crown, key
  • 自然:tree, flower, sun, moon, star, mountain, ocean, rainbow
  • 角色:skull, robot, angel, wizard, pirate, ninja, alien
  • 节日:christmas, halloween, valentine
  • 提示:

  • 保留艺术家的签名/署名——这是重要的礼仪
  • 每页有多件艺术作品——为用户挑选最佳的一件
  • 通过 curl 即可可靠使用,无需 JavaScript
  • 来源 B:GitHub Octocat API(有趣的彩蛋)

    返回随机的 GitHub Octocat 角色并附上一句智慧名言。无需认证。

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

    工具 8:趣味 ASCII 工具(通过 curl)

    这些免费服务直接返回 ASCII 艺术——非常适合趣味附加内容。

    ASCII 艺术二维码

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

    ASCII 艺术天气

    
    curl -s "wttr.in/London"          # Full weather report with ASCII graphics
    curl -s "wttr.in/Moon"            # Moon phase in ASCII art
    curl -s "v2.wttr.in/London"       # Detailed version
    

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

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

    字符调色板

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

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

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

    规则

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

  • 文本横幅 → 已安装则用 pyfiglet,否则通过 curl 使用 asciified API
  • 用趣味角色艺术包裹消息 → cowsay
  • 添加装饰性边框/框架 → boxes(可与 pyfiglet/asciified 组合使用)
  • 特定对象的艺术(猫、火箭、龙)→ 通过 curl 抓取 ascii.co.uk 并解析
  • 将图片转换为 ASCII → ascii-image-converter 或 jp2a
  • 二维码 → 通过 curl 使用 qrenco.de
  • 天气/月亮艺术 → 通过 curl 使用 wttr.in
  • 自定义/创意内容 → 使用 Unicode 调色板进行 LLM 生成
  • 任何未安装的工具 → 安装它,或回退到下一个选项
  • 哥特`gothic`戏剧化文本

    安装指南

    复制下方命令,在终端运行即可安装:

    # 安装到当前项目
    npx skills add ascii-art
    # 全局安装 — 所有项目可用
    npx skills add ascii-art -g
    ⚡ 一键安装到 GenHub

    需已安装 GenHub 桌面端

    使用指南

    安装完成后,在对话框中直接使用此技能。

    基本信息
    作者 Community 分类 agent 难度 Intermediate 时长 1 hour
    🛠️ 安装命令
    # 安装到当前项目
    npx skills add ascii-art
    # 全局安装
    npx skills add ascii-art -g

    发表评论