CLI-QR-Refiner
A specialized tool for OpenClaw agents to capture and refine rough ASCII/Unicode QR code blocks from CLI terminal outputs into crystal-clear, scannable PNG images.
Features
- - Block Recognition: Automatically interprets
█ (full), ▀ (upper), and ▄ (lower) block characters. - Pixel-Perfect Scaling: Renders vector-like precision to ensure zero scanning failures.
- Zero Dependencies: Built on Python 3 + PIL (pre-installed on most systems).
- Headless Optimized: Designed specifically for server-side environments where terminal displays are unreliable.
Dependencies
- - Runtime: Python 3 (no external packages required — uses built-in PIL/Pillow)
Tools & Commands
The refinement logic resides in
{baseDir}/scripts/cli_qr_refiner.py.
Refinement Command
CODEBLOCK0
- -
input_txt_path: Path to text file containing ASCII QR code - INLINECODE5 : Path for output PNG image
- INLINECODE6 (optional): Pixel size per character cell, default 10
Prompting / Behavior
When to use
Trigger this skill when:
- 1. A CLI tool (e.g., WeChat, Aliyun, NPM) outputs a block-character matrix intended for scanning.
- The user reports scanning failures due to terminal alignment, line-height, or font issues.
How to use
- 1. Capture: Extract the raw character block from the terminal output.
- Save: Write the captured block to a temporary file (e.g.,
/tmp/qr_source.txt). - Refine: Run the Python script to generate the high-def image.
- Deliver: Send the refined PNG to the user.
Examples
Input (ASCII/Unicode)
CODEBLOCK1
Output
A professional, high-definition PNG file, ready for any scanning app.
How it works
Each character in the ASCII QR maps to a cell:
- -
█ → full black cell - INLINECODE9 → upper-half black cell
- INLINECODE10 → lower-half black cell
- INLINECODE11 (space) → white cell
The script scales each cell to scale × scale*2 pixels for crisp rendering.
CLI-QR-Refiner
一个专为OpenClaw代理设计的工具,用于从CLI终端输出中捕获并精炼粗糙的ASCII/Unicode二维码块,生成清晰可扫描的PNG图像。
特性
- - 块识别:自动解析█(全块)、▀(上半块)和▄(下半块)字符。
- 像素级缩放:呈现矢量级精度,确保零扫描失败。
- 零依赖:基于Python 3 + PIL构建(大多数系统预装)。
- 无头优化:专为终端显示不可靠的服务器端环境设计。
依赖项
- - 运行时:Python 3(无需外部包——使用内置PIL/Pillow)
工具与命令
精炼逻辑位于{baseDir}/scripts/cli
qrrefiner.py。
精炼命令
bash
python3 {baseDir}/scripts/cli
qrrefiner.py <输入文本路径> <输出PNG路径> [缩放比例]
- - 输入文本路径:包含ASCII二维码的文本文件路径
- 输出PNG路径:输出PNG图像的路径
- 缩放比例(可选):每个字符单元的像素大小,默认为10
提示/行为
使用时机
在以下情况触发此技能:
- 1. CLI工具(如微信、阿里云、NPM)输出用于扫描的块字符矩阵。
- 用户报告因终端对齐、行高或字体问题导致扫描失败。
使用方法
- 1. 捕获:从终端输出中提取原始字符块。
- 保存:将捕获的块写入临时文件(例如/tmp/qr_source.txt)。
- 精炼:运行Python脚本生成高清图像。
- 交付:将精炼后的PNG发送给用户。
示例
输入(ASCII/Unicode)
text
██████████████ ██ ██████████████
██ ██ ██ ██ ██
██ ██████ ██ ██ ██████ ██
输出
一个专业的高清PNG文件,适用于任何扫描应用。
工作原理
ASCII二维码中的每个字符映射到一个单元:
- - █ → 全黑单元
- ▀ → 上半黑单元
- ▄ → 下半黑单元
- (空格)→ 白色单元
脚本将每个单元缩放为缩放比例 × 缩放比例*2像素,实现清晰渲染。