🤖HermesBlog
Hermes 功能详解 · 第21篇2026/8/9· Easy Understand Hermes Agent

第21篇:图像生成——AI 画画

Hermes 功能详解第21篇:图像生成。让 Hermes 根据描述生成图片,支持多种模型后端。

图像生成:自助画室

第21篇:图像生成——AI 画画

上一期我们聊了定时任务,有小伙伴问:能不能让 Hermes 定时帮我画画? 比如每天早上自动生成一张“今日壁纸”推送到手机?当然可以!而且这正好用上了咱们的 Cron 技能 + 图像生成能力。

不过在动手之前,先记住一个关键概念:Cron 任务跑在全新的会话里,它不记得你之前聊过什么。所以你的提示词必须自包含——把画画需要的所有信息都写进去。

先来个最简单的:定时画一张图

/cron add "every 1h" "Generate an image of a cute cat wearing a tiny hat, watercolor style. Deliver the image to me." --deliver telegram

就这么简单?对,就这么简单。Hermes 会每小时画一只戴帽子的小猫发给你。但如果你不想每小时都被猫刷屏,可以用 [SILENT] 技巧——让 Agent 在“没什么好画”的时候保持安静。

进阶玩法:结合脚本,画“会变化”的图

Cron 的 script 参数是个秘密武器。脚本先跑,它的输出会作为上下文给 Agent。比如我们写一个脚本,每天抓取当日热点新闻标题,然后让 Agent 根据标题画一张“新闻插画”:

import urllib.request, json

# 抓取 Hacker News 头条
url = "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
top_ids = json.loads(urllib.request.urlopen(url).read())[:3]

titles = []
for id in top_ids:
    item = json.loads(urllib.request.urlopen(
        f"https://hacker-news.firebaseio.com/v0/item/{id}.json?print=pretty"
    ).read())
    titles.append(item.get("title", ""))

print("Today's top HN stories:")
for t in titles:
    print(f"- {t}")

然后设置定时任务:

/cron add "0 8 * * *" "Read the script output. Pick the most interesting news title, and generate a symbolic illustration representing that story. Style: minimalist flat design. Deliver the image." --script ~/.hermes/scripts/daily-news.py --name "每日新闻插画" --deliver telegram

每天早上 8 点,Hermes 会先看新闻,再画一张跟新闻相关的插画——每天都不一样,这才是 AI 画画的乐趣。

画风控制:把“审美”写进提示词

Cron 任务没有记忆,所以画风偏好必须写全。比如:

/cron add "0 12 * * 0" "Generate a weekly motivational quote image. Style: Japanese ukiyo-e woodblock print aesthetic, warm colors, text overlay with the quote in elegant serif font. Quote should be about perseverance. Deliver the image." --name "周日鸡汤图" --deliver discord

注意我把风格(浮世绘)、配色(暖色)、字体(衬线体)全写进去了。你甚至可以把自己喜欢的艺术家名字写进去:“in the style of Studio Ghibli backgrounds”。

零 Token 方案:不需要 LLM 的定时任务

如果你只是想要定时生成图片并发送,根本不需要 Agent 思考——那可以用 script-only cron,让脚本直接调图像 API,省下 Token。在聊天里跟 Hermes 说:“帮我设一个每天生成壁纸的 script-only 任务”,cronjob 工具会自动帮你搞定。

小总结

需求 方案
定时画固定风格的图 /cron add + 详细风格提示词
根据外部数据画画 --script 脚本输出 + Agent 理解
不想被频繁打扰 提示词里加 [SILENT]
完全不需要 AI 思考 script-only cron 或 hermes send

图像生成 + Cron,等于你有了一个24 小时不睡觉的私人画师。明天早上醒来,看看 Telegram 里 Hermes 给你画了什么?说不定是今天的天气预报插画呢。

📖 官方文档

本文根据 Hermes Agent 官方文档编写,原文见:官方文档 › guides/automate-with-cron