Skip to main content

svg2png-clipboard

Convert SVG content from clipboard to PNG and copy it back - perfect for quickly converting SVG icons for use in applications that don't support SVG.

Features

  • 📋 Read SVG directly from clipboard
  • 🖼️ Convert to PNG with customizable size
  • 📋 Copy PNG back to clipboard automatically
  • 💾 Optional file input/output
  • 🔔 macOS notifications
  • ✅ Robust error handling and dependency checking

Requirements

  • macOS (uses pbpaste and osascript)
  • Python 3.8+
  • rsvg-convert (from librsvg)

Installation

Using pipx (Recommended)

# Install system dependency first
brew install librsvg

# Install with pipx
pipx install svg2png-clipboard

Using pip

# Install system dependency
brew install librsvg

# Install package
pip install svg2png-clipboard

From source

# Clone repository
git clone https://github.com/yourusername/svg2png-clipboard
cd svg2png-clipboard

# Install system dependency
brew install librsvg

# Install package
pip install -e .

Usage

Basic usage (clipboard to clipboard)

# Copy SVG to clipboard, then:
svg2png-clipboard

Specify output size

svg2png-clipboard --size 512  # Creates 512x512 PNG

File operations

# Read from file, copy to clipboard
svg2png-clipboard --input icon.svg

# Read from clipboard, save to file
svg2png-clipboard --output icon.png

# Read from file, save to file
svg2png-clipboard --input icon.svg --output icon.png

Other options

# Disable notifications
svg2png-clipboard --no-notification

# Verbose output
svg2png-clipboard --verbose

# Show help
svg2png-clipboard --help

Examples

  1. Quick icon conversion: Copy an SVG icon from a website, run svg2png-clipboard, paste the PNG anywhere

  2. Batch conversion with custom size:

    svg2png-clipboard -i logo.svg -o logo-256.png -s 256
    
  3. Debug mode:

    svg2png-clipboard --verbose
    

Troubleshooting

"rsvg-convert is not installed"

Install librsvg using Homebrew:

brew install librsvg

"This tool only works on macOS"

This tool requires macOS-specific utilities (pbpaste, osascript). For other platforms, consider using the file input/output options with platform-specific clipboard tools.

Invalid SVG content

Make sure the clipboard contains valid SVG. You can verify with:

pbpaste | head -n 5

Development

# Install in development mode
pip install -e ".[dev]"

# Run tests (if available)
pytest

# Build package
python -m build

License

MIT License

Author

Hsieh-Ting Lin, the Lizard 🦎

Metadata

Release files for svg2png-clipboard 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for svg2png-clipboard 0.1.0
File Size Uploaded
svg2png_clipboard-0.1.0.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for svg2png-clipboard 0.1.0
File Interpreter ABI Platform
svg2png_clipboard-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / svg2png_clipboard-0.1.0.tar.gz

Download URL svg2png_clipboard-0.1.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6e588c7c162751e2a9280731c1e0ba080f678be792da6ed5c30b17315460de7f
BLAKE2b-256 checksum
How to use checksums
1a16a9030d7e2e4db9f2387a1e6f6a93bf201a4bfe234ae40f13cc23ce04ac70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / svg2png_clipboard-0.1.0-py3-none-any.whl

Download URL svg2png_clipboard-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7be53edcf1951d7272970d1ac9464488a7d3f88f00b78da2cf7c664c5e63934
BLAKE2b-256 checksum
How to use checksums
3ac1738e757fd7fefa368fabd6f36c0f82a6cfd14bd3f57e6d4adbc4cb1e04c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page