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.3.0.tar.gz (112.8 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.3.0-cp39-abi3-win_amd64.whl (308.5 kB view details)

Uploaded CPython 3.9+Windows x86-64

arthash-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (401.6 kB view details)

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

arthash-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (367.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

arthash-0.3.0-cp39-abi3-macosx_11_0_arm64.whl (347.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

arthash-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl (379.9 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for arthash-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ba04221a519bf92a1cc8c383b39aee5ca8beae14592256418d5ab8453773896b
MD5 73c86ac505a204eba6038087c932c9b6
BLAKE2b-256 6755612dd96f10ed8e0ddce1b80834c4e65b0e0925235f3037050861a670903c

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.3.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.3.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: arthash-0.3.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 308.5 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.3.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 92c84aaa329eb0349cba3ec621f44e20d5ec8213acd9bda22f51b3db387bc2a6
MD5 bb827c15e7469700a125b490da209447
BLAKE2b-256 4b949dcf28f615a0f95c27a46f7ed3257af9fc24ddc39cc89187418139eec0d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.3.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.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for arthash-0.3.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2e39c64e39bcf54995b034a3036c08fddf838a60d332b6d30341f93dd78820f
MD5 21d1c85c8712a6d68477def43b2d5d83
BLAKE2b-256 e8bd3c37df81873cc6e81a44e925d31ee126ac0d5ede3197d984e576bf4c189c

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.3.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.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for arthash-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7f80cde5966869e1c45a49fdd31145f0b7c0d82528b689519722ee449a6fa99a
MD5 1be08b43f8d03d10b1c49bc93e59db01
BLAKE2b-256 6ed3b764bf8e8c763ccd044c8138e8dac41c5d94323ab82c552ffb0bb610fd62

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.3.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.3.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for arthash-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ab4e61cb47a8a9dc71cafcb028ab65fb575d875bb9ac293d74d88228cb245aa2
MD5 b26bd78740e91f688f32982e603801a3
BLAKE2b-256 d014bcea8746311473677d84e00c06546bdca4bbb761cab246febc3fc3d6cec9

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.3.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.3.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for arthash-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 194349310d64239e34fc5246d994490873ea405769ad08a0a5e51dd6c60129e1
MD5 fdd8182b45cb709714488a51ee5f78c4
BLAKE2b-256 f33b5fdbec3535a3f19fce6d6cf442cdd0c5b6c17dc8386a083d789d45fb4856

See more details on using hashes here.

Provenance

The following attestation bundles were made for arthash-0.3.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