pixellens 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abolfazl Moeini
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,133 @@
1
+ Metadata-Version: 2.4
2
+ Name: pixellens
3
+ Version: 0.1.0
4
+ Summary: Local-first CLI for converting animations/icons/3D images to SVG/AVIF/WebP with pixel, layout, and SSIM diffing.
5
+ Author: Abolfazl Moeini
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/abolfazl-moeini/pixellens
8
+ Project-URL: Repository, https://github.com/abolfazl-moeini/pixellens
9
+ Project-URL: Issues, https://github.com/abolfazl-moeini/pixellens/issues
10
+ Keywords: svg,avif,webp,lottie,gif,ssim,image-diff,visual-regression,iconkat
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
24
+ Classifier: Topic :: Software Development :: Testing
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Dynamic: license-file
29
+
30
+ # PixelLens
31
+
32
+ > **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 to `iconkat`.)*
33
+
34
+ ```bash
35
+ # 1. Auto-detect & convert any icon, animation, or 3D image
36
+ python3 pixellens.py input.png
37
+
38
+ # 2. Convert & self-verify similarity against the original
39
+ python3 pixellens.py icon3d.png --svg --verify
40
+
41
+ # 3. Compare two images (JSON output for CI / automation)
42
+ python3 pixellens.py compare before.png after.png --common-area --tolerance 8 --json
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Features
48
+
49
+ - **Smart Format Detection (`pixellens.py` / `iconkat.py`)**: Inspects binary headers and pixel tone distribution (ignoring file extensions) and routes to the best converter:
50
+ - **Lottie JSON** → Self-contained Animated SVG (`json2svg/lottie_to_svg.py`)
51
+ - **Animated GIF / APNG / WebP** → Pure CSS keyframe Animated SVG (`gif2svg/gif_to_svg_frames.py` or `--gif-mode stroke`)
52
+ - **2D Flat / Mono Icons** → Crisp SVG via **VTracer** (`img2svg/vtracer_cli.js`)
53
+ - **3D / Multi-tone Images** → **AVIF** (`q=88`) + **WebP Lossless** by default, or SVG via **Windfoil** (WebGPU/Metal) / **VTracer** with `--svg`
54
+ - **Visual & Perceptual Diff (`compare`)**:
55
+ - **Pixel Diff**: Channel-level RGBA diff with configurable `--tolerance`, bounding box, and optional `--diff-out` PNG.
56
+ - **Layout Similarity**: `16×16` tile mean-RGB matching (`0.0`–`1.0`).
57
+ - **Perceptual Similarity**: Proportional downscale (max `512px`) + `8×8` luminance SSIM (`0.0`–`1.0`).
58
+ - **Noise Mask & Cropping**: `--ignore mask.png` skips white mask tiles; `--common-area` crops mismatched viewport heights from top-left.
59
+ - **Zero Python Dependencies**: Pure Python stdlib + ImageMagick (`magick`).
60
+
61
+ ---
62
+
63
+ ## Installation
64
+
65
+ ```bash
66
+ pip install pixellens
67
+ # or run without installing globally:
68
+ uvx pixellens --help
69
+ ```
70
+
71
+ > **Note:** Installing `pixellens` provides both `pixellens` and `iconkat` CLI commands.
72
+
73
+ ## Prerequisites
74
+
75
+ - **Python 3.10+**
76
+ - **ImageMagick** (`brew install imagemagick`)
77
+ - **Node.js >= 22** (optional, for VTracer: `cd src/pixellens/img2svg && npm install`)
78
+ - **Windfoil (optional, macOS GPU 3D→SVG)**:
79
+ ```bash
80
+ git clone --depth 1 https://github.com/texel-org/windfoil-paper.git /tmp/windfoil-paper
81
+ cd /tmp/windfoil-paper && npm install
82
+ ```
83
+
84
+ ---
85
+
86
+ ## CLI Usage
87
+
88
+ ### Convert & Verify
89
+
90
+ | Flag | Values | Default | Description |
91
+ | :--- | :--- | :--- | :--- |
92
+ | `--svg` | — | off | Also generate SVG for 3D/multi-tone images |
93
+ | `--svg-only` | — | off | Generate only SVG (skip AVIF/WebP) |
94
+ | `--svg-engine` | `auto\|windfoil\|vtracer\|python` | `auto` | SVG vectorization engine |
95
+ | `--wf-shapes` / `--wf-steps` | int | `512` / `600` | Windfoil shape count and optimization steps |
96
+ | `--size` | int (px) | original | Resize AVIF/WebP output (e.g. `128`, `256`) |
97
+ | `--gif-mode` | `frames\|stroke` | `frames` | Animated GIF SVG mode |
98
+ | `--step` | int | `1` | Frame sampling step in `frames` mode |
99
+ | `--grid` | — | off | Export `512×512` 64px reference grid PNG |
100
+ | `--inspect-only` | — | off | Print detected file type without converting |
101
+ | `--verify` | — | off | Rasterize generated SVG and score similarity |
102
+
103
+ ### Compare Two Images
104
+
105
+ ```bash
106
+ python3 pixellens.py compare before.png after.png \
107
+ --common-area \
108
+ --tolerance 8 \
109
+ --ignore noise-mask.png \
110
+ --diff-out diff.png \
111
+ --min-similarity 0.90 \
112
+ --json
113
+ ```
114
+
115
+ Exit codes: `0` = passed (`layout_similarity >= min` and `perceptual_similarity >= min`), `1` = failed/not comparable, `2` = error.
116
+
117
+ ---
118
+
119
+ ## Structure
120
+
121
+ ```text
122
+ pixellens/
123
+ ├── pyproject.toml # PyPI packaging & console scripts (pixellens, iconkat)
124
+ ├── pixellens.py # Local PixelLens CLI launcher
125
+ ├── iconkat.py # Local backward-compatible CLI launcher
126
+ ├── src/pixellens/
127
+ │ ├── cli.py # Core CLI & auto-detection router
128
+ │ ├── compare/ # Pixel, layout, and SSIM comparison engine
129
+ │ ├── json2svg/ # Lottie JSON -> Animated SVG
130
+ │ ├── gif2svg/ # GIF/APNG/WebP -> Pure CSS Animated SVG
131
+ │ └── img2svg/ # VTracer, Windfoil, and Python SVG engines
132
+ └── tests/ # Unit & regression tests (pytest)
133
+ ```
@@ -0,0 +1,104 @@
1
+ # PixelLens
2
+
3
+ > **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 to `iconkat`.)*
4
+
5
+ ```bash
6
+ # 1. Auto-detect & convert any icon, animation, or 3D image
7
+ python3 pixellens.py input.png
8
+
9
+ # 2. Convert & self-verify similarity against the original
10
+ python3 pixellens.py icon3d.png --svg --verify
11
+
12
+ # 3. Compare two images (JSON output for CI / automation)
13
+ python3 pixellens.py compare before.png after.png --common-area --tolerance 8 --json
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Features
19
+
20
+ - **Smart Format Detection (`pixellens.py` / `iconkat.py`)**: Inspects binary headers and pixel tone distribution (ignoring file extensions) and routes to the best converter:
21
+ - **Lottie JSON** → Self-contained Animated SVG (`json2svg/lottie_to_svg.py`)
22
+ - **Animated GIF / APNG / WebP** → Pure CSS keyframe Animated SVG (`gif2svg/gif_to_svg_frames.py` or `--gif-mode stroke`)
23
+ - **2D Flat / Mono Icons** → Crisp SVG via **VTracer** (`img2svg/vtracer_cli.js`)
24
+ - **3D / Multi-tone Images** → **AVIF** (`q=88`) + **WebP Lossless** by default, or SVG via **Windfoil** (WebGPU/Metal) / **VTracer** with `--svg`
25
+ - **Visual & Perceptual Diff (`compare`)**:
26
+ - **Pixel Diff**: Channel-level RGBA diff with configurable `--tolerance`, bounding box, and optional `--diff-out` PNG.
27
+ - **Layout Similarity**: `16×16` tile mean-RGB matching (`0.0`–`1.0`).
28
+ - **Perceptual Similarity**: Proportional downscale (max `512px`) + `8×8` luminance SSIM (`0.0`–`1.0`).
29
+ - **Noise Mask & Cropping**: `--ignore mask.png` skips white mask tiles; `--common-area` crops mismatched viewport heights from top-left.
30
+ - **Zero Python Dependencies**: Pure Python stdlib + ImageMagick (`magick`).
31
+
32
+ ---
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pip install pixellens
38
+ # or run without installing globally:
39
+ uvx pixellens --help
40
+ ```
41
+
42
+ > **Note:** Installing `pixellens` provides both `pixellens` and `iconkat` CLI commands.
43
+
44
+ ## Prerequisites
45
+
46
+ - **Python 3.10+**
47
+ - **ImageMagick** (`brew install imagemagick`)
48
+ - **Node.js >= 22** (optional, for VTracer: `cd src/pixellens/img2svg && npm install`)
49
+ - **Windfoil (optional, macOS GPU 3D→SVG)**:
50
+ ```bash
51
+ git clone --depth 1 https://github.com/texel-org/windfoil-paper.git /tmp/windfoil-paper
52
+ cd /tmp/windfoil-paper && npm install
53
+ ```
54
+
55
+ ---
56
+
57
+ ## CLI Usage
58
+
59
+ ### Convert & Verify
60
+
61
+ | Flag | Values | Default | Description |
62
+ | :--- | :--- | :--- | :--- |
63
+ | `--svg` | — | off | Also generate SVG for 3D/multi-tone images |
64
+ | `--svg-only` | — | off | Generate only SVG (skip AVIF/WebP) |
65
+ | `--svg-engine` | `auto\|windfoil\|vtracer\|python` | `auto` | SVG vectorization engine |
66
+ | `--wf-shapes` / `--wf-steps` | int | `512` / `600` | Windfoil shape count and optimization steps |
67
+ | `--size` | int (px) | original | Resize AVIF/WebP output (e.g. `128`, `256`) |
68
+ | `--gif-mode` | `frames\|stroke` | `frames` | Animated GIF SVG mode |
69
+ | `--step` | int | `1` | Frame sampling step in `frames` mode |
70
+ | `--grid` | — | off | Export `512×512` 64px reference grid PNG |
71
+ | `--inspect-only` | — | off | Print detected file type without converting |
72
+ | `--verify` | — | off | Rasterize generated SVG and score similarity |
73
+
74
+ ### Compare Two Images
75
+
76
+ ```bash
77
+ python3 pixellens.py compare before.png after.png \
78
+ --common-area \
79
+ --tolerance 8 \
80
+ --ignore noise-mask.png \
81
+ --diff-out diff.png \
82
+ --min-similarity 0.90 \
83
+ --json
84
+ ```
85
+
86
+ Exit codes: `0` = passed (`layout_similarity >= min` and `perceptual_similarity >= min`), `1` = failed/not comparable, `2` = error.
87
+
88
+ ---
89
+
90
+ ## Structure
91
+
92
+ ```text
93
+ pixellens/
94
+ ├── pyproject.toml # PyPI packaging & console scripts (pixellens, iconkat)
95
+ ├── pixellens.py # Local PixelLens CLI launcher
96
+ ├── iconkat.py # Local backward-compatible CLI launcher
97
+ ├── src/pixellens/
98
+ │ ├── cli.py # Core CLI & auto-detection router
99
+ │ ├── compare/ # Pixel, layout, and SSIM comparison engine
100
+ │ ├── json2svg/ # Lottie JSON -> Animated SVG
101
+ │ ├── gif2svg/ # GIF/APNG/WebP -> Pure CSS Animated SVG
102
+ │ └── img2svg/ # VTracer, Windfoil, and Python SVG engines
103
+ └── tests/ # Unit & regression tests (pytest)
104
+ ```
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pixellens"
7
+ version = "0.1.0"
8
+ description = "Local-first CLI for converting animations/icons/3D images to SVG/AVIF/WebP with pixel, layout, and SSIM diffing."
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "Abolfazl Moeini" },
14
+ ]
15
+ keywords = ["svg", "avif", "webp", "lottie", "gif", "ssim", "image-diff", "visual-regression", "iconkat"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: Developers",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: MacOS",
22
+ "Operating System :: POSIX :: Linux",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14",
29
+ "Topic :: Multimedia :: Graphics :: Graphics Conversion",
30
+ "Topic :: Software Development :: Testing",
31
+ ]
32
+ dependencies = []
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/abolfazl-moeini/pixellens"
36
+ Repository = "https://github.com/abolfazl-moeini/pixellens"
37
+ Issues = "https://github.com/abolfazl-moeini/pixellens/issues"
38
+
39
+ [project.scripts]
40
+ pixellens = "pixellens.cli:main"
41
+ iconkat = "pixellens.cli:main"
42
+
43
+ [tool.setuptools.packages.find]
44
+ where = ["src"]
45
+
46
+ [tool.setuptools.package-data]
47
+ pixellens = ["img2svg/*.js", "img2svg/package.json"]
48
+
49
+ [tool.setuptools.exclude-package-data]
50
+ pixellens = ["img2svg/node_modules/*", "img2svg/windfoil-paper/*"]
51
+
52
+ [tool.pytest.ini_options]
53
+ pythonpath = ["src"]
54
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ """PixelLens — local-first media converter and pixel/layout/SSIM diff engine."""
2
+
3
+ from __future__ import annotations
4
+
5
+ __version__ = "0.1.0"
6
+
7
+ from pixellens.cli import inspect_file, main
8
+ from pixellens.compare.pixels import compare_images, load_rgba
9
+
10
+ __all__ = ["__version__", "compare_images", "inspect_file", "load_rgba", "main"]