Skill: freedompixels/qrcode-tool (version 1.0.0)

--- slug: qrcode-tool name: QR Code Generator description: "Generate QR codes from URLs or text. Export as PNG with customizable size. No API key required." keywords: qrcode, qr, barcode, generator, url, text version: "1.0.0" author: Qiance language: en --- # QR Code Generator Generate QR codes from any text or URL. Supports customization and exports as PNG format. ## Features - Generate QR codes from any text/URL - Custom size (default 300px) - Custom margin - Export as PNG format - No API key required ## Usage ```bash # Generate QR code for URL python3 scripts/qrcode_generator.py "https://example.com" # Generate QR code for text python3 scripts/qrcode_generator.py "Hello World" # Custom size python3 scripts/qrcode_generator.py "https://example.com" --size 500 ``` ## Examples ``` Generate QR code for: https://github.com Generate QR code for: Contact me at [REDACTED_SECRET] Generate QR code for: WIFI:T:WPA;S:MyNetwork;P:password;; ``` ## Technical Details - Uses qrserver.com public API - SSL certificate verification enabled (certifi) - No sensitive data transmission ## Dependencies - Python 3.7+ - certifi (SSL certificates) ## Privacy Note Input text is sent to api.qrserver.com (third-party service). Not recommended for sensitive information. --- ## 中文说明 输入URL或文本，生成PNG二维码。 - 自定义尺寸（默认300px） - 无需API Key - 使用qrserver.com公开API

path: README.md
content: # QR Code Generator

Generate QR codes from any text or URL with customizable options.

## Installation

No installation required. Uses Python standard library + certifi for SSL.

```bash
pip install certifi  # Optional but recommended for SSL verification
```

## Usage

### Basic Usage

```bash
# Generate QR code for URL
python3 scripts/qrcode_generator.py "https://example.com"

# Generate QR code for text
python3 scripts/qrcode_generator.py "Hello World"
```

### Advanced Options

```bash
# Custom size
python3 scripts/qrcode_generator.py "https://example.com" --size 500

# Custom margin
python3 scripts/qrcode_generator.py "Hello" --margin 2

# Different format
python3 scripts/qrcode_generator.py "Test" --format gif

# JSON output
python3 scripts/qrcode_generator.py "https://example.com" --json
```

## Examples

| Input | Use Case |
|-------|----------|
| `https://github.com` | Website URL |
| `mailto:[REDACTED_SECRET]` | Email link |
| `tel:+1234567890` | Phone number |
| `WIFI:T:WPA;S:MyNetwork;P:password;;` | WiFi credentials |
| `Hello World` | Plain text |

## API

Uses the free [qrserver.com API](https://api.qrserver.com). No API key required.

## Privacy

⚠️ Input text is sent to a third-party API (api.qrserver.com). Do not use for sensitive information like passwords or private keys.

## License

MIT License


path: scripts/qrcode_generator.py
content: #!/usr/bin/env python3
"""QR Code Generator - Generate QR codes from text/URL"""
import sys
import os
import base64
import ssl
import urllib.request
import urllib.parse
import argparse

try:
    import certifi
    CERTIFI_AVAILABLE = True
except ImportError:
    CERTIFI_AVAILABLE = False

def generate_qrcode(text, size=300, margin=4, format='png'):
    """Generate QR code using qrserver.com API
    
    Args:
        text: Text or URL to encode
        size: QR code size in pixels (default 300)
        margin: Margin around QR code (default 4)
        format: Output format (default png)
    
    Returns:
        dict with success status and data/base64 or error message
    """
    encoded_text = urllib.parse.quote(text)
    url = f"https://api.qrserver.com/v1/create-qr-code/?size={size}x{size}&margin={margin}&format={format}&data={encoded_text}"
    
    headers = {
        'User-Agent': 'QRCode-Tool/1.0 (https://github.com/qiance)'
    }
    
    try:
        # SSL with certifi if available, fallback to default
        if CERTIFI_AVAILABLE:
            ctx = ssl.create_default_context()
            ctx.load_verify_locations(certifi.where())
        else:
            ctx = ssl.create_default_context()
        
        req = urllib.request.Request(url, headers=headers)
        response = urllib.request.urlopen(req, timeout=15, context=ctx)
        data = response.read()
        
        return {
            "success": True,
            "data": f"data:image/{format};base64,{base64.b64encode(data).decode()}",
            "url": url,
            "size": size,
            "text_length": len(text)
        }
    except Exception as e:
        return {"success": False, "error": str(e)}

def main():
    parser = argparse.ArgumentParser(
        description='Generate QR codes from text or URLs',
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog="""
Examples:
  python3 qrcode_generator.py "https://example.com"
  python3 qrcode_generator.py "Hello World" --size 500
  python3 qrcode_generator.py "WIFI:T:WPA;S:MyNetwork;P:password;;" --margin 2
        """
    )
    
    parser.add_argument('text', help='Text or URL to encode')
    parser.add_argument('--size', type=int, default=300, help='QR code size in pixels (default: 300)')
    parser.add_argument('--margin', type=int, default=4, help='Margin around QR code (default: 4)')
    parser.add_argument('--format', choices=['png', 'gif', 'jpeg', 'jpg'], default='png', help='Output format (default: png)')
    parser.add_argument('--json', action='store_true', help='Output as JSON')
    
    args = parser.parse_args()
    
    result = generate_qrcode(args.text, args.size, args.margin, args.format)
    
    if args.json:
        import json
        print(json.dumps(result, indent=2))
    else:
        if result["success"]:
            print(f"✅ QR Code generated successfully!")
            print(f"   Size: {result['size']}x{result['size']} pixels")
            print(f"   Text length: {result['text_length']} characters")
            print(f"   Base64 length: {len(result['data'])} characters")
        else:
            print(f"❌ Failed to generate QR code: {result['error']}")

if __name__ == '__main__':
    main()


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)