PixelLens
TL;DR: Local-first CLI for converting Lottie JSON, animated GIF/APNG/WebP, and 2D/3D raster images into optimal web formats (SVG, AVIF, WebP Lossless), plus a zero-pip-dependency pixel, layout, and perceptual (SSIM) image diff engine (
compare&--verify). (Backward-compatible successor toiconkat.)
# 1. Auto-detect & convert any icon, animation, or 3D image
python3 pixellens.py input.png
# 2. Convert & self-verify similarity against the original
python3 pixellens.py icon3d.png --svg --verify
# 3. Compare two images (JSON output for CI / automation)
python3 pixellens.py compare before.png after.png --common-area --tolerance 8 --json
Features
- Smart Format Detection (
pixellens.py/iconkat.py): Inspects binary headers and pixel tone distribution (ignoring file extensions) and routes to the best converter:- Lottie JSON → Self-contained Animated SVG (
json2svg/lottie_to_svg.py) - Animated GIF / APNG / WebP → Pure CSS keyframe Animated SVG (
gif2svg/gif_to_svg_frames.pyor--gif-mode stroke) - 2D Flat / Mono Icons → Crisp SVG via VTracer (
img2svg/vtracer_cli.js) - 3D / Multi-tone Images → AVIF (
q=88) + WebP Lossless by default, or SVG via Windfoil (WebGPU/Metal) / VTracer with--svg
- Lottie JSON → Self-contained Animated SVG (
- Visual & Perceptual Diff (
compare):- Pixel Diff: Channel-level RGBA diff with configurable
--tolerance, bounding box, and optional--diff-outPNG. - Layout Similarity:
16×16tile mean-RGB matching (0.0–1.0). - Perceptual Similarity: Proportional downscale (max
512px) +8×8luminance SSIM (0.0–1.0). - Noise Mask & Cropping:
--ignore mask.pngskips white mask tiles;--common-areacrops mismatched viewport heights from top-left.
- Pixel Diff: Channel-level RGBA diff with configurable
- Zero Python Dependencies: Pure Python stdlib + ImageMagick (
magick).
Installation
pip install pixellens
# or run without installing globally:
uvx pixellens --help
Note: Installing
pixellensprovides bothpixellensandiconkatCLI commands.
Prerequisites
- Python 3.10+
- ImageMagick (
brew install imagemagick) - Node.js >= 22 (optional, for VTracer:
cd src/pixellens/img2svg && npm install) - Windfoil (optional, macOS GPU 3D→SVG):
git clone --depth 1 https://github.com/texel-org/windfoil-paper.git /tmp/windfoil-paper cd /tmp/windfoil-paper && npm install
CLI Usage
Convert & Verify
| Flag | Values | Default | Description |
|---|---|---|---|
--svg |
— | off | Also generate SVG for 3D/multi-tone images |
--svg-only |
— | off | Generate only SVG (skip AVIF/WebP) |
--svg-engine |
auto|windfoil|vtracer|python |
auto |
SVG vectorization engine |
--wf-shapes / --wf-steps |
int | 512 / 600 |
Windfoil shape count and optimization steps |
--size |
int (px) | original | Resize AVIF/WebP output (e.g. 128, 256) |
--gif-mode |
frames|stroke |
frames |
Animated GIF SVG mode |
--step |
int | 1 |
Frame sampling step in frames mode |
--grid |
— | off | Export 512×512 64px reference grid PNG |
--inspect-only |
— | off | Print detected file type without converting |
--verify |
— | off | Rasterize generated SVG and score similarity |
Compare Two Images
python3 pixellens.py compare before.png after.png \
--common-area \
--tolerance 8 \
--ignore noise-mask.png \
--diff-out diff.png \
--min-similarity 0.90 \
--json
Exit codes: 0 = passed (layout_similarity >= min and perceptual_similarity >= min), 1 = failed/not comparable, 2 = error.
Structure
pixellens/
├── pyproject.toml # PyPI packaging & console scripts (pixellens, iconkat)
├── pixellens.py # Local PixelLens CLI launcher
├── iconkat.py # Local backward-compatible CLI launcher
├── src/pixellens/
│ ├── cli.py # Core CLI & auto-detection router
│ ├── compare/ # Pixel, layout, and SSIM comparison engine
│ ├── json2svg/ # Lottie JSON -> Animated SVG
│ ├── gif2svg/ # GIF/APNG/WebP -> Pure CSS Animated SVG
│ └── img2svg/ # VTracer, Windfoil, and Python SVG engines
└── tests/ # Unit & regression tests (pytest)
Metadata
Release files for pixellens 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pixellens-0.1.0.tar.gz | 34.9 kB | Without provenance | Details for pixellens-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pixellens-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pixellens-0.1.0-py3-none-any.whl |
Total release size: 73.5 kB
Release files / pixellens-0.1.0.tar.gz
| Download URL | pixellens-0.1.0.tar.gz |
|---|---|
| Size | 34.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18cdbe255057d2ce169cdea9694f6ccd431ccf1a7fe3a863fcc2aba42cb6264b
|
|
BLAKE2b-256 checksum How to use checksums |
f72162ff0b06dbf3668e46f051e5d36d0111b406bcd989b1d90243bed9cbd118
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / pixellens-0.1.0-py3-none-any.whl
| Download URL | pixellens-0.1.0-py3-none-any.whl |
|---|---|
| Size | 38.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c227d77ed836f7290d4eacd24afa714d21f464b3f5723f8f8a628b98dd01db19
|
|
BLAKE2b-256 checksum How to use checksums |
887382534bb50db7161c390131755e5cfa1c8e43d21249914c200455b2425018
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for pixellens 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.