qrcode-generator

TotalClaw 作者 bowen nan v2.0.0

从文本、URL 或图像生成 QR 码。当用户要求“生成 QR 码”、“创建 QR”或“为其创建 QR 码”时使用。支持文本内容、URL 和本地图像(自动压缩)。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~nbf819-web-pr-generator
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~nbf819-web-pr-generator/file -o nbf819-web-pr-generator.md
## 概述(中文)

从文本、URL 或图像生成 QR 码。当用户要求“生成 QR 码”、“创建 QR”或“为其创建 QR 码”时使用。支持文本内容、URL 和本地图像(自动压缩)。

## 原文

# QR Code Generator

Generate QR codes from text, URLs, or local images. Perfect for sharing links, contact information, or small images via scannable codes.

## Features
- ✅ Generate QR codes from text
- ✅ Generate QR codes from URLs  
- ✅ Generate QR codes from local images (auto-compressed)
- ✅ Customizable QR code size and colors
- ✅ Returns image path for easy sharing

## Installation
```bash
pip install qrcode[pil] pillow
```

## Usage Examples

### Basic Usage
```python
from agent import handle_call

# Generate QR for URL
result = handle_call({"content": "https://openclaw.ai"})

# Generate QR for text
result = handle_call({"content": "Hello OpenClaw"})

# Generate QR from image
result = handle_call({"image": "/path/to/image.jpg"})
```

### Command Line
```bash
# Install dependencies first
pip install qrcode[pil] pillow

# Run the example
python example.py
```

## Parameters
- `content` (string): Text or URL to encode
- `image` (string): Full path to local image file

## Returns
- `image_path`: Path to generated QR code image
- `error`: Error message if failed
- `message`: Informational message

## Notes
- Images larger than 10MB will be rejected
- Large images are automatically compressed for QR encoding
- For best results with images, use URLs instead of local files