← 返回 Skills 市场
xtoyun

雄韬书法AI应用 - 汉字重心

作者 xtoyun · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
36
总下载
1
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install hanzi-center
功能描述
雄韬汉字视觉重心分析引擎——基于"分量·距离·斜度"三要素模型,融合启功结字黄金律与阿恩海姆视知觉理论,对任意汉字进行像素级视觉重心计算。当用户问及汉字重心、书法结构、字体平衡、"这个字为什么看起来歪"、中宫收紧、结字法则、不同字体的重心差异时使用。支持楷/宋/黑/仿/明/思源6种字体切换、多字对比、中宫热力分析...
使用说明 (SKILL.md)

雄韬汉字视觉重心

雄韬出品的汉字视觉重心智能分析工具。基于分量 · 距离 · 斜度三要素模型,融合启功"结字黄金律"和阿恩海姆视知觉理论,对任意汉字进行像素级分析,输出数据报告与可视化图片。

🌐 在线演示http://shufa.xtocn.com/汉字视觉重心.html 📂 开源地址https://github.com/xtoyun/zhishufa

何时使用

  • 用户输入单个汉字,询问其重心/结构/平衡
  • 用户想对比多个汉字的视觉重心差异
  • 用户询问某个字为什么"看起来歪"或"写得不对"
  • 用户提到"中宫"、"重心"、"结字"等书法术语
  • 用户想在不同字体下分析同一个字

分析引擎

核心脚本:{baseDir}/scripts/analyze.js,基于 node-canvas 无头渲染 + 像素级分析。

依赖已在 {baseDir}/package.json 声明(npm install 后即可使用)。首次使用前确保依赖已安装。

默认行为:运行后同时输出文字报告和一张可视化 PNG 图片(hanzi_\x3C字>_\x3C字体>.png),图片包含汉字渲染 + 视觉重心/物理质心/几何中心标注。可用 --no-png 关闭。

基本调用

cd "{baseDir}" && node scripts/analyze.js \x3C汉字> [选项]

常用场景

场景 1:单个字分析 — 用户问"永字的重心在哪"

cd "{baseDir}" && node scripts/analyze.js 永

场景 2:多字对比 — 用户问"对比 重、飞、不、中 的重心"

cd "{baseDir}" && node scripts/analyze.js 重 --compare 飞,不,中

场景 3:切换字体 — 用户问"用宋体分析'我'字"

cd "{baseDir}" && node scripts/analyze.js 我 --font=song

场景 4:调参探究 — 用户问"中宫收紧调到最大看'家'字"

cd "{baseDir}" && node scripts/analyze.js 家 --density=100

场景 5:JSON 导出 — 用户问"把'龙'的数据导出来"

cd "{baseDir}" && node scripts/analyze.js 龙 --json

完整选项

选项 说明 默认
-f, --font kai / song / hei / fangsong / ming / noto kai
-w, --weight 分量权重 0–100 70
-d, --density 中宫收紧 0–100 60
-s, --slant 斜度影响 0–100 40
-u, --upbias 偏上偏差 0–15 6.0
-r, --rightbias 偏右偏差 -5–10 2.5
-c, --compare 对比字(逗号分隔)
-j, --json JSON 输出
--png 生成可视化图片 默认开启
--no-png 不生成图片
--fonts 列出字体

报告字段解读

把输出结果用自然语言解释给用户:

  • 视觉重心 vs 几何中心 vs 物理质心:三者差异越大,说明字的结构张力越强
  • 偏移方向:偏上=符合"上紧下松"审美;偏左/偏右=笔画天然分布不对称
  • 上:下 / 左:右 比例:偏离 50:50 越远,该方向的笔画分布越不均匀
  • 解读:结合偏移量自动生成,引用启功、姜夔等书论

字体说明

key 名称 说明
kai 楷书 最接近手写,默认字体
song 宋体 横细竖粗,印刷正体
hei 黑体 笔画均匀,现代风格
fangsong 仿宋 楷体骨架宋体笔形
ming 明体 台湾标准印刷体
noto 思源宋 Google 开源,跨平台

依赖系统字体。如果渲染异常,提示用户换一种字体试试。

算法简述(面向用户的解释)

按顺序告诉用户(不要堆砌术语):

  1. Canvas 画出汉字 → 逐像素提取墨色
  2. 算出物理质心(纯数学平均)
  3. 密度网格重新加权 → 笔画密集区"吸附"重心(模拟中宫)
  4. 笔画方向检测 → 横竖撇捺的"拉力"微调重心
  5. 加上人眼偏好(偏上看约 6%)→ 得到最终视觉重心

注意

  • 每次只分析一个主汉字,对比模式最多附带 4 个
  • 默认参数是经验优化值,一般无需调整
  • 分析纯本地计算,不联网
安全使用建议
Install this if you want a local Hanzi visual-center analysis helper. Be aware it requires npm dependencies including the native canvas package, and by default it saves PNG files in the working directory; use --no-png or run it in a scratch workspace if you do not want generated images retained.
能力评估
Purpose & Capability
The Node script renders Hanzi with canvas, computes visual center metrics, prints reports, and can generate a PNG; these capabilities match the stated calligraphy-analysis purpose.
Instruction Scope
The routing language is somewhat broad for Chinese characters and calligraphy questions, but the documented use cases remain aligned with character structure, balance, fonts, and visual-center analysis.
Install Mechanism
The skill declares a normal npm dependency on canvas; canvas has a native install script via its package, which is expected for that library, and the skill itself does not define install, postinstall, or background execution hooks.
Credentials
Runtime behavior is local: it uses node-canvas, checks a small set of system font paths, and writes analysis output; no runtime network calls, subprocess execution, credential access, or broad local indexing were found.
Persistence & Privilege
By default the script writes a predictable PNG file such as hanzi_<char>_<font>.png in the current directory, which is disclosed and purpose-aligned but can leave local artifacts or overwrite an existing file with the same name.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install hanzi-center
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /hanzi-center 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Updated skill name and description to "雄韬汉字视觉重心分析引擎", emphasizing the "雄韬" branding and technical highlights. - Clarified context of use to match real-world calligraphy/visual center inquiries. - No code or functional changes; documentation and metadata improvements only. - All analysis features, options, and usage remain unchanged.
v1.0.0
Initial release – analyze the visual center of gravity for Chinese characters (hanzi): - Supports single-character analysis and multi-character visual center comparison. - Provides detailed, pixel-level gravity reports and annotated PNG visualizations. - Supports six major Chinese fonts: 楷, 宋, 黑, 仿, 明, 思源(kai, song, hei, fangsong, ming, noto). - Offers a variety of options, including font switching, density/weight adjustment, JSON export, and image toggling. - Explains results in natural language with reference to calligraphy theory and historical literature. - Requires Node.js environment with documented dependencies; analyzes characters fully offline.
元数据
Slug hanzi-center
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

雄韬书法AI应用 - 汉字重心 是什么?

雄韬汉字视觉重心分析引擎——基于"分量·距离·斜度"三要素模型,融合启功结字黄金律与阿恩海姆视知觉理论,对任意汉字进行像素级视觉重心计算。当用户问及汉字重心、书法结构、字体平衡、"这个字为什么看起来歪"、中宫收紧、结字法则、不同字体的重心差异时使用。支持楷/宋/黑/仿/明/思源6种字体切换、多字对比、中宫热力分析... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 36 次。

如何安装 雄韬书法AI应用 - 汉字重心?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install hanzi-center」即可一键安装,无需额外配置。

雄韬书法AI应用 - 汉字重心 是免费的吗?

是的,雄韬书法AI应用 - 汉字重心 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

雄韬书法AI应用 - 汉字重心 支持哪些平台?

雄韬书法AI应用 - 汉字重心 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 雄韬书法AI应用 - 汉字重心?

由 xtoyun(@xtoyun)开发并维护,当前版本 v1.0.1。

💬 留言讨论