Qr Code Generator

TotalClaw 作者 anisafifi v0.1.0

当用户出于任何目的需要创建 QR 码时,请使用此技能。触发因素包括:请求“生成 QR 码”、“创建 QR”、“为其创建 QR 码”或提及将数据编码为可扫描代码。支持 URL、文本、WiFi 凭证、vCard(联系信息)、电子邮件地址、电话号码、短信、位置坐标、日历事件和自定义数据。可以自定义颜色、添加徽标、生成批量 QR 码以及以多种格式导出(PNG、SVG、PDF)。需要从clawhub.ai 安装 OpenClawCLI。

源码 ↗

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:anisafifi~qr-code-generator
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Aanisafifi~qr-code-generator/file -o qr-code-generator.md
Git 仓库获取源码
git clone https://github.com/openclaw/skills/commit/60da225b310f57937c8f2caf7fed5a68c28ad0d0
## 概述(中文)

当用户出于任何目的需要创建 QR 码时,请使用此技能。触发因素包括:请求“生成 QR 码”、“创建 QR”、“为其创建 QR 码”或提及将数据编码为可扫描代码。支持 URL、文本、WiFi 凭证、vCard(联系信息)、电子邮件地址、电话号码、短信、位置坐标、日历事件和自定义数据。可以自定义颜色、添加徽标、生成批量 QR 码以及以多种格式导出(PNG、SVG、PDF)。需要从clawhub.ai 安装 OpenClawCLI。

## 原文

# QR Code Generator

Generate customizable QR codes for URLs, text, WiFi credentials, contact cards, and more. Supports batch generation, custom styling, logo embedding, and multiple export formats.

⚠️ **Prerequisite:** Install [OpenClawCLI](https://clawhub.ai/) (Windows, MacOS)

**Installation:**
```bash
# Standard installation
pip install qrcode[pil] segno

# If you encounter permission errors, use a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install qrcode[pil] segno
```

**Never use `--break-system-packages`** as it can damage your system's Python installation.

---

## Quick Reference

| Task | Command |
|------|---------|
| Basic URL QR code | `python scripts/qr.py "https://example.com"` |
| Text QR code | `python scripts/qr.py --type text "Hello World"` |
| WiFi QR code | `python scripts/qr.py --type wifi --ssid "MyNetwork" --password "secret"` |
| vCard contact | `python scripts/qr.py --type vcard --name "John Doe" --phone "+1234567890"` |
| Custom colors | `python scripts/qr.py "URL" --fg-color blue --bg-color white` |
| With logo | `python scripts/qr.py "URL" --logo logo.png` |
| SVG format | `python scripts/qr.py "URL" --format svg` |
| Batch generation | `python scripts/qr.py --batch urls.txt --output-dir qrcodes/` |

---

## Core Features

### 1. Multiple Data Types

Generate QR codes for various data types with automatic formatting.

**Supported Types:**
- **URL** - Websites and web links
- **Text** - Plain text messages
- **WiFi** - WiFi network credentials
- **vCard** - Contact information (VCF format)
- **Email** - Email addresses with optional subject/body
- **Phone** - Phone numbers (tel: links)
- **SMS** - SMS messages with recipient and text
- **Geo** - Geographic coordinates
- **Event** - Calendar events (iCal format)
- **Custom** - Any custom data

### 2. Customization Options

Personalize QR code appearance:
- Foreground and background colors
- Custom error correction levels
- Border size adjustment
- Module size control
- Logo/image embedding

### 3. Multiple Export Formats

Export in various formats for different use cases:
- **PNG** - Raster images (default)
- **SVG** - Vector graphics (scalable)
- **PDF** - Print-ready documents
- **EPS** - Vector format for design tools
- **Terminal** - ASCII art for terminal display

### 4. Batch Processing

Generate multiple QR codes from:
- Text files (one entry per line)
- CSV files (with metadata)
- JSON files (with configuration)

---

## Basic Usage

### URL QR Codes

Generate QR codes for websites and links.

```bash
# Simple URL
python scripts/qr.py "https://example.com"

# With custom filename
python scripts/qr.py "https://github.com" --output github_qr.png

# High error correction for printed codes
python scripts/qr.py "https://mysite.com" --error-correction H --output site_qr.png
```

**Output:**
```
QR code generated: qrcode.png
Size: 290x290 pixels
Error correction: M (Medium)
Data: https://example.com
```

### Text QR Codes

Encode plain text messages.

```bash
# Simple text
python scripts/qr.py --type text "Hello, World!"

# Multi-line text
python scripts/qr.py --type text "Line 1\nLine 2\nLine 3" --output message.png

# Large text (automatic size adjustment)
python scripts/qr.py --type text "$(cat message.txt)" --output text_qr.png
```

### WiFi QR Codes

Create scannable WiFi credentials.

```bash
# WPA/WPA2 network
python scripts/qr.py --type wifi --ssid "MyNetwork" --password "SecurePassword123"

# WPA2 network (explicit)
python scripts/qr.py --type wifi --ssid "HomeWiFi" --password "pass123" --security WPA

# Hidden network
python scripts/qr.py --type wifi --ssid "SecretNet" --password "secret" --hidden

# Open network (no password)
python scripts/qr.py --type wifi --ssid "GuestNetwork" --security nopass
```

**Security types:** `WPA`, `WEP`, `nopass`

**Output QR contains:**
```
WIFI:T:WPA;S:MyNetwork;P:SecurePassword123;H:false;;
```

### Contact Cards (vCard)

Generate vCard QR codes for easy contact sharing.

```bash
# Basic contact
python scripts/qr.py --type vcard --name "John Doe" --phone "+1234567890"

# Full contact details
python scripts/qr.py --type vcard \
  --name "Jane Smith" \
  --phone "+1234567890" \
  --email "jane@example.com" \
  --organization "Tech Corp" \
  --title "Senior Developer" \
  --url "https://janesmith.com" \
  --address "123 Main St, City, State, 12345" \
  --output jane_contact.png

# Multiple phone numbers
python scripts/qr.py --type vcard \
  --name "Bob Johnson" \
  --phone "+1234567890" \
  --phone-home "+0987654321" \
  --email "bob@email.com"
```

**Generated vCard format:**
```
BEGIN:VCARD
VERSION:3.0
FN:John Doe
TEL:+1234567890
END:VCARD
```

### Email QR Codes

Create mailto: links with optional subject and body.

```bash
# Simple email
python scripts/qr.py --type email --email "contact@example.com"

# With subject
python scripts/qr.py --type email --email "support@company.com" --subject "Support Request"

# With subject and body
python scripts/qr.py --type email \
  --email "info@example.com" \
  --subject "Inquiry" \
  --body "I would like more information about..."
```

**Output QR contains:**
```
mailto:contact@example.com?subject=Support%20Request&body=Message%20text
```

### Phone Number QR Codes

Generate clickable phone links.

```bash
# Simple phone number
python scripts/qr.py --type phone --phone "+1234567890"

# International format
python scripts/qr.py --type phone --phone "+44 20 7946 0958"
```

**Output QR contains:**
```
tel:+1234567890
```

### SMS QR Codes

Create pre-filled SMS messages.

```bash
# SMS with recipient only
python scripts/qr.py --type sms --phone "+1234567890"

# SMS with message
python scripts/qr.py --type sms --phone "+1234567890" --message "Hello from QR code!"
```

**Output QR contains:**
```
sms:+1234567890?body=Hello%20from%20QR%20code!
```

### Geographic Location QR Codes

Encode GPS coordinates.

```bash
# Coordinates only
python scripts/qr.py --type geo --latitude 37.7749 --longitude -122.4194

# With altitude
python scripts/qr.py --type geo --latitude 40.7128 --longitude -74.0060 --altitude 10

# Named location
python scripts/qr.py --type geo --latitude 51.5074 --longitude -0.1278 --location-name "London"
```

**Output QR contains:**
```
geo:37.7749,-122.4194
```

### Calendar Event QR Codes

Generate iCalendar event QR codes.

```bash
# Basic event
python scripts/qr.py --type event \
  --event-title "Team Meeting" \
  --event-start "2024-03-15T14:00:00" \
  --event-end "2024-03-15T15:00:00"

# Full event details
python scripts/qr.py --type event \
  --event-title "Conference 2024" \
  --event-start "2024-06-01T09:00:00" \
  --event-end "2024-06-01T17:00:00" \
  --event-location "Convention Center, NYC" \
  --event-description "Annual tech conference" \
  --output conference_qr.png
```

---

## Customization Options

### Colors

Customize foreground and background colors.

```bash
# Named colors
python scripts/qr.py "https://example.com" --fg-color blue --bg-color white

# Hex colors
python scripts/qr.py "https://example.com" --fg-color "#FF0000" --bg-color "#FFFFFF"

# RGB colors
python scripts/qr.py "https://example.com" --fg-color "rgb(0,100,200)" --bg-color "rgb(255,255,255)"

# Transparent background
python scripts/qr.py "https://example.com" --bg-color transparent --format png
```

**Common color names:** black, white, red, blue, green, yellow, orange, purple, pink, brown, gray

### Error Correction

Set error correction level (higher = more damage resistance).

```bash
--error-correction <L|M|Q|H>
```

**Levels:**
- **L** - Low (~7% recovery) - Use for digital display
- **M** - Medium (~15% recovery) - Default, good balance
- **Q** - Quartile (~25% recovery) - Use when adding log