ErisPulse-Takumi
Render images in your Bot — HTML / node trees / SVG / animations, with CJK fonts out of the box.
English
Image rendering for ErisPulse, built on takumi-py. Noto Sans SC, Roboto and Source Code Pro are bundled, so Chinese / English / monospace text just works — no extra font setup.
Supports HTML, node trees, Jinja templates, SVG and animations.
Install
epsdk install Takumi
Usage
The module auto-loads. Grab it through the module manager, or use the sdk shortcut:
from ErisPulse import sdk
takumi = sdk.module.get("Takumi")
# equivalent: takumi = sdk.Takumi
Render HTML
png = takumi.render_html(
"""
<div class="card">
<h1>Hello, ErisPulse</h1>
<p>Rendered by Takumi</p>
</div>
""",
stylesheets=["""
.card {
width: 800px;
height: 400px;
padding: 48px;
color: white;
background: #111827;
font-family: "Noto Sans SC";
}
"""],
width=800,
height=400,
lang="zh-CN",
)
Render a node tree
png = takumi.render_node(
{
"type": "text",
"text": "中英混排 renders fine",
"style": {"fontSize": 48, "color": "#111827"},
},
width=800,
height=200,
lang="zh-CN",
)
Raw Renderer
takumi.renderer is the underlying takumi_py.Renderer. The convenience methods above inject the bundled font fallback automatically; when you call the renderer directly, pass the families yourself:
png = takumi.renderer.render_html(
"<div>hello</div>",
font_families=takumi.families,
lang="zh-CN",
)
Independent Renderer
Need isolated font / image / resource caches? Spin up a fresh Renderer — the bundled fonts are auto-registered:
renderer = takumi.create_renderer(cache_max_bytes=64 * 1024 * 1024)
png = renderer.render_html(
"<div>isolated renderer</div>",
font_families=takumi.families,
width=800,
height=200,
lang="zh-CN",
)
create_renderer() takes the takumi_py.Renderer constructor kwargs. It defaults to load_default_fonts=False (bundled fonts only); pass load_default_fonts=True to also load Takumi's own, and fonts=[...] to register custom fonts alongside.
An independent instance bypasses the module proxy, so pass font_families=takumi.families explicitly to keep the same fallback stack.
Bundled resources:
takumi.fonts— bundled font filenamestakumi.families— registered font families
Pass font_families yourself and the module respects it — no default fallback is injected. RenderOptions(font_families=...) works too.
Config
[Takumi]
enabled = true
简体中文
ErisPulse 的图片渲染模块,基于 takumi-py。内置 Noto Sans SC、Roboto、Source Code Pro,中文 / 英文 / 等宽文本开箱即用,无需额外配置字体。
支持 HTML、节点树、Jinja 模板、SVG 和动画渲染。
安装
epsdk install Takumi
使用
模块会自动加载,通过模块管理器获取,也可以用 sdk 快捷方式:
from ErisPulse import sdk
takumi = sdk.module.get("Takumi")
# 等价写法:takumi = sdk.Takumi
渲染 HTML
png = takumi.render_html(
"""
<div class="card">
<h1>你好,ErisPulse</h1>
<p>由 Takumi 渲染</p>
</div>
""",
stylesheets=["""
.card {
width: 800px;
height: 400px;
padding: 48px;
color: white;
background: #111827;
font-family: "Noto Sans SC";
}
"""],
width=800,
height=400,
lang="zh-CN",
)
渲染节点树
png = takumi.render_node(
{
"type": "text",
"text": "中文和 English 都可直接渲染",
"style": {"fontSize": 48, "color": "#111827"},
},
width=800,
height=200,
lang="zh-CN",
)
原生 Renderer
takumi.renderer 是原始的 takumi_py.Renderer 实例。上面的便捷方法会自动注入内置字体回退栈;直接调用 renderer 时自行传入 families:
png = takumi.renderer.render_html(
"<div>你好</div>",
font_families=takumi.families,
lang="zh-CN",
)
独立 Renderer
需要隔离字体 / 图片 / 资源缓存时,创建新的 Renderer,内置字体会自动注册:
renderer = takumi.create_renderer(cache_max_bytes=64 * 1024 * 1024)
png = renderer.render_html(
"<div>独立 Renderer</div>",
font_families=takumi.families,
width=800,
height=200,
lang="zh-CN",
)
create_renderer() 接受 takumi_py.Renderer 的构造参数。默认 load_default_fonts=False(仅加载内置字体);传入 load_default_fonts=True 可同时加载 Takumi 自带字体,fonts=[...] 可一并注册自定义字体。
独立实例不经过模块代理,因此若要保留统一的内置字体回退栈,需显式传入 font_families=takumi.families。
内置资源:
takumi.fonts:内置字体文件名takumi.families:已注册的字体 family
若显式传入 font_families,模块会尊重调用方设置,不再注入默认回退栈。RenderOptions(font_families=...) 同样有效。
配置
[Takumi]
enabled = true
Related · ErisPulse · takumi-py · Documentation · Issues
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file erispulse_takumi-1.2.0.tar.gz.
File metadata
- Download URL: erispulse_takumi-1.2.0.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f23fb682b20f2fea6cab2ccf72929dc19afbfa51216b3f4d003870c98b23cd
|
|
| MD5 |
4639ab380ed152a86f4a37c88c01b9cb
|
|
| BLAKE2b-256 |
5bc9829b663311daa3f7745f17b8d816958790d80434852f06ccc4937042eeb9
|
File details
Details for the file erispulse_takumi-1.2.0-py3-none-any.whl.
File metadata
- Download URL: erispulse_takumi-1.2.0-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c404bd348ff9e1a0ef207acf28bb37425a2000a3b4fa849b70a7ec117316a441
|
|
| MD5 |
eba7d039a7479ed132ce2f3a9a360764
|
|
| BLAKE2b-256 |
3f17a2efa5e9e5b6c67812fd2b04abb949a9efbc792306e9c15e33b6ed417b41
|