Skip to main content

Placeholder-image hash family — DCT / CIRCLE / TRIANGLE / SQUARE / RECT / ROTATED_RECT / PIXEL modes share a unified Codec API. PyO3 binding to arthash-rs.

Project description

arthash

Placeholder-image hash family. Seven modes share a unified Codec API:

Shape Bytes (typical) Notes
DCT ~21 B ThumbHash V4 derivative. Default.
CIRCLE varies SQIP-style overlapping circles.
TRIANGLE varies fogleman/primitive-style triangle mosaic.
SQUARE varies Axis-aligned squares (cx, cy, side).
RECT varies Axis-aligned rectangles (cx, cy, w, h).
ROTATED_RECT varies Rotated rectangles — theta_bits tunes angle steps.
PIXEL varies Retro-palette pixel mosaic.

The implementation is a thin Python wrapper around the arthash-rs Rust crate exposed via PyO3 — encode/decode/SVG all run in native code.

Install (from source)

maturin develop --uv -m packages/arthash-py/Cargo.toml

Quick start

from arthash import encode, decode, to_svg, Codec, Preset, RenderStyle
from arthash.palettes import PICO8

# DCT (default)
h = encode("photo.jpg")
w, hh, rgba = decode(h, base_size=256)              # (h, w, 4) RGBA ndarray

# Named preset
codec = Codec.preset(Preset.LARGE_TRIANGLE)         # triangle, n=64
h = encode("photo.jpg", codec)

# Factory + palette
codec = Codec.triangle(n=24, palette=PICO8)
h = encode("photo.jpg", codec, seed=0)
svg = to_svg(h, codec, base_size=256,
             style=RenderStyle(blur=8.0))           # circle/triangle/etc.

decode always returns (width, height, ndarray(h, w, 4)) regardless of codec — alpha is 255 except for DCT-with-alpha sources.

Visual styling — RenderStyle

decode and to_svg accept a style=RenderStyle(blur=…, corner_radius=…) for visual softening. Both fields are applied identically across paths so raster and SVG outputs stay visually consistent. corner_radius is only honored for rect / square / rotated_rect codecs; other shapes silently ignore it. to_svg(..., blur=...) still works but is deprecated since 0.3.0 — pass style=RenderStyle(blur=...) instead.

Layout

  • python/arthash/ — public Python API (Codec, ShapeType, SearchOptions, palettes, encode, decode, to_svg).
  • src/lib.rs — PyO3 binding to the arthash Rust crate. Compiled into arthash._native.
  • tests/ — pytest suite covering codec validation, V4 round-trip, shape round-trip, SVG generation, search-options, and the cross-language test vectors at docs/test-vectors/vectors.json.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arthash-0.4.0.tar.gz (113.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

arthash-0.4.0-cp39-abi3-win_amd64.whl (308.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

arthash-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (401.9 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

arthash-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (367.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

arthash-0.4.0-cp39-abi3-macosx_11_0_arm64.whl (347.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

arthash-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl (380.1 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file arthash-0.4.0.tar.gz.

File metadata

  • Download URL: arthash-0.4.0.tar.gz
  • Upload date:
  • Size: 113.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arthash-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b95952376d153509f86f36688f08f4167c1e8af67d4e17494eeffc4aa3d890cc
MD5 297cea652e5ce10f63a6f9a4f29323b7
BLAKE2b-256 9107fcc579d7faaecae2a4ab69bc6897767ce93cc465882dcdf6bfeaa375a025

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.4.0.tar.gz:

Publisher: wheels.yml on Jannchie/arthash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arthash-0.4.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: arthash-0.4.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 308.7 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for arthash-0.4.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3de8b954b6e4b8daf5a1241cbedb2200b8737730e39f78a4f2f48e96b0570b55
MD5 12fb9f1d125ac141558c926523e071ea
BLAKE2b-256 7f0b7b90298f37d07274181835f1f8da94f27b39466d07263bb8300b1669ca82

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.4.0-cp39-abi3-win_amd64.whl:

Publisher: wheels.yml on Jannchie/arthash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arthash-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for arthash-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6653cb8f82bce9fb142a1a25a1addfad5eefada61ec0d895d26d1f4c0fd3fa62
MD5 0646ba740cdc99a6b099a062eccdc94b
BLAKE2b-256 da935a02e219719ae935ae36ce1f8223d17cf0393af08fa3db9be5baefbde8f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: wheels.yml on Jannchie/arthash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arthash-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for arthash-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5b05de81082d9a4dad18e3ea16a9e6e6a20c0693278f73f06f8613a07ad6c9b1
MD5 847adc4c0555719f538d91ad922b3138
BLAKE2b-256 9ddfb58284cac8b2f07449248944e14310a403d0b7b6c74966abf16c3d8c01cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: wheels.yml on Jannchie/arthash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arthash-0.4.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for arthash-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d021424911f5bec34e088d008e96704905cbfd83c0936cfec1dadc4c7447e640
MD5 14fa512bceed6beb84fe873fecf4acdf
BLAKE2b-256 bb9cf2578e7b1801055cb4e6be77f4c1f8ab201240e3d00f5c3151570ca73af9

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.4.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: wheels.yml on Jannchie/arthash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arthash-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for arthash-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 87929005cdc1123d12f5331597dd00306bbf76fb39aa4e142ebc408e4530c4a2
MD5 ec126dbf51427c545d1b7885eede474b
BLAKE2b-256 f08eab1ae5a7eebca38ea9997e49d81fa6b5a7ea3f1eb2b3267eb3ed192c17f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: wheels.yml on Jannchie/arthash

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page