pixel-convert 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,63 @@
1
+ Metadata-Version: 2.4
2
+ Name: pixel-convert
3
+ Version: 0.1.0
4
+ Classifier: Programming Language :: Python
5
+ Classifier: Programming Language :: Rust
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Operating System :: MacOS
8
+ Classifier: Operating System :: Microsoft :: Windows
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Requires-Dist: pillow>=9
11
+ Summary: PyO3-powered image transform for Pixel-convert (Rust core)
12
+ Keywords: image,rust,pyo3,pillow,clustering
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
15
+
16
+ pixel_convert (Python package)
17
+
18
+ This package exposes a Python API backed by the Rust `pixel_convert_rust` core via PyO3.
19
+
20
+ API
21
+ - `pixel_convert.transform(image: PIL.Image.Image, width: int, height: int, kmax: int, *, fast=False, stride=None, stride_x=None, stride_y=None, alpha=None, epsilon_palette=None, t_final=None, stag_eps=None, stag_limit=None, threads=None, iter_timings=False) -> PIL.Image.Image`
22
+ - `pixel_convert.transform_file(input_path: str, output_path: str, width: int, height: int, kmax: int, *, fast=False, stride=None, stride_x=None, stride_y=None, alpha=None, epsilon_palette=None, t_final=None, stag_eps=None, stag_limit=None, threads=None, iter_timings=False) -> None`
23
+
24
+ Build from source
25
+ - `pip install maturin`
26
+ - `maturin build -m pixel_convert/Cargo.toml --release`
27
+ - `pip install target/wheels/*.whl`
28
+
29
+ Develop install for local testing
30
+ - `maturin develop -m pixel_convert/Cargo.toml`
31
+
32
+ Example
33
+ ```
34
+ from PIL import Image
35
+ import pixel_convert as rx
36
+
37
+ img = Image.open("examples/input_images/dog3.jpg")
38
+ out = rx.transform(img, 128, 128, 30, fast=True)
39
+ out.save("examples/output_images/dog3_py_128x128_30.png")
40
+ ```
41
+
42
+ File-to-file example (faster, Rust handles I/O)
43
+ ```
44
+ import pixel_convert as rx
45
+
46
+ rx.transform_file(
47
+ "examples/input_images/dog3.jpg",
48
+ "examples/output_images/dog3_py_128x128_30.png",
49
+ 128,
50
+ 128,
51
+ 30,
52
+ fast=True,
53
+ threads=4,
54
+ )
55
+ ```
56
+
57
+ Timing per iteration (logs)
58
+ ```
59
+ import pixel_convert as rx, os
60
+ os.environ["RUST_LOG"] = "info"
61
+ rx.transform_file("examples/input_images/dog3.jpg", "examples/output_images/dog3_py_128x128_30.png", 128, 128, 30, iter_timings=True)
62
+ ```
63
+
@@ -0,0 +1,47 @@
1
+ pixel_convert (Python package)
2
+
3
+ This package exposes a Python API backed by the Rust `pixel_convert_rust` core via PyO3.
4
+
5
+ API
6
+ - `pixel_convert.transform(image: PIL.Image.Image, width: int, height: int, kmax: int, *, fast=False, stride=None, stride_x=None, stride_y=None, alpha=None, epsilon_palette=None, t_final=None, stag_eps=None, stag_limit=None, threads=None, iter_timings=False) -> PIL.Image.Image`
7
+ - `pixel_convert.transform_file(input_path: str, output_path: str, width: int, height: int, kmax: int, *, fast=False, stride=None, stride_x=None, stride_y=None, alpha=None, epsilon_palette=None, t_final=None, stag_eps=None, stag_limit=None, threads=None, iter_timings=False) -> None`
8
+
9
+ Build from source
10
+ - `pip install maturin`
11
+ - `maturin build -m pixel_convert/Cargo.toml --release`
12
+ - `pip install target/wheels/*.whl`
13
+
14
+ Develop install for local testing
15
+ - `maturin develop -m pixel_convert/Cargo.toml`
16
+
17
+ Example
18
+ ```
19
+ from PIL import Image
20
+ import pixel_convert as rx
21
+
22
+ img = Image.open("examples/input_images/dog3.jpg")
23
+ out = rx.transform(img, 128, 128, 30, fast=True)
24
+ out.save("examples/output_images/dog3_py_128x128_30.png")
25
+ ```
26
+
27
+ File-to-file example (faster, Rust handles I/O)
28
+ ```
29
+ import pixel_convert as rx
30
+
31
+ rx.transform_file(
32
+ "examples/input_images/dog3.jpg",
33
+ "examples/output_images/dog3_py_128x128_30.png",
34
+ 128,
35
+ 128,
36
+ 30,
37
+ fast=True,
38
+ threads=4,
39
+ )
40
+ ```
41
+
42
+ Timing per iteration (logs)
43
+ ```
44
+ import pixel_convert as rx, os
45
+ os.environ["RUST_LOG"] = "info"
46
+ rx.transform_file("examples/input_images/dog3.jpg", "examples/output_images/dog3_py_128x128_30.png", 128, 128, 30, iter_timings=True)
47
+ ```
@@ -0,0 +1,5 @@
1
+ [target.aarch64-apple-darwin]
2
+ rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]
3
+
4
+ [target.x86_64-apple-darwin]
5
+ rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]