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.5.0.tar.gz (125.6 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.5.0-cp39-abi3-win_amd64.whl (309.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

arthash-0.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (402.4 kB view details)

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

arthash-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (367.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

arthash-0.5.0-cp39-abi3-macosx_11_0_arm64.whl (348.2 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

arthash-0.5.0-cp39-abi3-macosx_10_12_x86_64.whl (379.6 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for arthash-0.5.0.tar.gz
Algorithm Hash digest
SHA256 7a9ca7952984fcfef95751d183a0008a48b02d44c6951b8a088513980539f951
MD5 2d90e68e1147b6e4ff27efea5e4279d5
BLAKE2b-256 2a2bfdcd6bfa53bdc11e9f6f1aa05bdd5a0b2c2bc4503a30e85dded5e92361b3

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: arthash-0.5.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 309.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.5.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5a584361b6ce507ecfe19b5bbe9e50df20c9aba32e8bb0d61d8da635db413fd0
MD5 8c1645aed8e56b70f2add68ebfacd265
BLAKE2b-256 83218132da3c761a379222dd62ab91ffb699e678c2983ecfe9cc8f0e1cf2cc8f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for arthash-0.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a60f171a4d45a38cb916b03286d6416a31a10b7f5b6e65dc7432f561ae148841
MD5 9028029ffbac06cc11ca5611af5d1d6e
BLAKE2b-256 318a6791a852a190b904adef1e3d5e417c8a728597a9d95178f0a699e7416d50

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for arthash-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b7aa0d2923b9a0a1b9e6861515dddef81377f1db98133ba3626967ac8768ca42
MD5 f156c66fda7448c5f6f25c7bdee4933a
BLAKE2b-256 0a0b78acf11f3692c4f8511d59854d680ef2afd0c4f27ff82447d988ce8a8d7a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for arthash-0.5.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06b7d8184c607d0d85818d9977f7748138dd2ebc9a6850bfb3e4fbe37af477e7
MD5 6c80bb198793650991a97446b207b047
BLAKE2b-256 6c912e8f8a0f71f8a18bfdaf7501f13373d9d52392f6daa27515127cd8d6432c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for arthash-0.5.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7bb27954c1dc9aadcc50ba0de8e769d4e81696c8f996f6eaf8d8f65e77780469
MD5 599a5183a26dedbe1fe966abfe18541f
BLAKE2b-256 997523913ab7e600e28731ca94935d04b8c80cf12ba7c0a0b9c569ed46643ec1

See more details on using hashes here.

Provenance

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