M AI 员工技能商店
AI 员工平台 返回商城
返回技能商店

小紫 二维码插件

v1.0.0 · 办公自动化 · 官方

二维码 QR 生成 解析 办公 小紫

简介

小紫 二维码插件 v1.0,本地生成与识别二维码:

  • generate 文本/URL/WiFi 字符串 → 二维码图片
  • decode 从 PNG/JPG 等图片识别二维码内容
  • batch 批量生成多个二维码
  • Win / macOS / Linux 通用,本地不上传

典型场景:活动链接出码、WiFi 分享码、名片网址、识别截图里的二维码。

操作说明

action功能
generate生成单张二维码
decode解析图片中的二维码
batch按 JSON 列表批量生成
info检查依赖是否安装

generate 参数:

  • content 必填,URL、文本、WiFi 字符串等
  • output 输出路径,不填则自动保存到 output 目录
  • size 模块像素,默认 10
  • error_correction 纠错 L/M/Q/H,默认 M
  • format png(默认)或 jpg

decode 参数:

  • filepath 图片路径,支持 png/jpg/bmp/webp 等

batch 参数:

  • items JSON 数组:[{"name":"官网","content":"https://..."}]
  • output_dir 批量输出目录

安装

  1. 解压到 D:\xiaozi-plugins\办公自动化\二维码插件\
  2. 复制 python/ 到本目录
  3. 安装依赖:
   python\python.exe -m pip install qrcode[pil] Pillow opencv-python-headless
  1. 测试:run.bat --action info
文件说明
qrcode_plugin.py主程序
run.bat / run.sh启动脚本
二维码插件.md用户文档

命令行

run.bat --action generate --content "https://www.example.com" --output D:\qr\site.png
run.bat --action generate --content "Hello 小紫" --size 12 --error_correction H
run.bat --action decode --filepath D:\qr\scan.png
run.bat --action batch --items "[{\"name\":\"a\",\"content\":\"https://a.com\"}]" --output_dir D:\qr\batch

注册技能 qrcode_tool

名称: qrcode_tool

描述: 二维码 v1.0。generate/decode/batch生成解析批量二维码。用户生成链接WiFi文本二维码、识别图片中QR码时使用。generate需content;decode需filepath;batch需items JSON。

脚本: D:\xiaozi-plugins\办公自动化\二维码插件\run.bat

参数 JSON:

{
  "type": "object",
  "properties": {
    "action": {"type": "string", "enum": ["generate", "decode", "batch", "info"], "description": "操作类型"},
    "content": {"type": "string", "description": "generate内容"},
    "output": {"type": "string", "description": "输出图片路径"},
    "filepath": {"type": "string", "description": "decode图片路径"},
    "items": {"type": "string", "description": "batch JSON数组"},
    "output_dir": {"type": "string", "description": "batch输出目录"},
    "size": {"type": "string", "description": "模块大小"},
    "border": {"type": "string", "description": "边框宽度"},
    "error_correction": {"type": "string", "description": "L/M/Q/H"},
    "format": {"type": "string", "description": "png/jpg"}
  },
  "required": ["action"]
}

对话示例

场景说法
生成把 https://example.com 生成二维码
WiFi生成 WiFi 二维码,内容是 xxx
识别看看这张图片里的二维码是什么
批量批量生成这几个链接的二维码
保存生成二维码保存到 D:\qr\a.png

常见错误

现象处理
缺依赖pip install qrcode[pil] Pillow opencv-python-headless
未识别图片不清晰或不是 QR 码
content 为空generate 必须传内容
python folder missing复制 python

能力边界

支持不支持
文本/URL/WiFi QR条形码
PNG/JPG 生成解析艺术码/Logo 嵌入
批量生成摄像头实时扫

与其他插件配合

  • image_tool:生成后压缩/转格式
  • ocr_tool:图文混合场景

详见包内 二维码插件.md。