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.1.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.1-cp39-abi3-win_amd64.whl (308.5 kB view details)

Uploaded CPython 3.9+Windows x86-64

arthash-0.3.1-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.1-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.1-cp39-abi3-macosx_11_0_arm64.whl (347.1 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

arthash-0.3.1-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.1.tar.gz.

File metadata

  • Download URL: arthash-0.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 208ed665e78ad4d6a04ddb0e4c0a16fdf5aa5d2cb5cacce3d58dfa8898239dc0
MD5 9735aa9034fff64816ab44e66e2169b3
BLAKE2b-256 7bdb051b3a5a0226576734cae480a33efad4f72a647fe0d3546926b5075eacbc

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: arthash-0.3.1-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.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c270a17d23673f629dc957a5baab7abc823a734378fb33b13fa5f05677d5e96d
MD5 5b9f15e354c819c4aa8b5661eba9c30a
BLAKE2b-256 677cb2864077c0098acadccc7628fc8f1831d7450812c9390d1bf60adb52ed22

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for arthash-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9516fc613ab1bf0fcb2c0627a359b3c32b51e1529706fe4637d7a0afe3731bf
MD5 0aa85a45214308a35289a928a3ded199
BLAKE2b-256 406200f3d1f4be508d826d3168693933af1166599c1c729673cd343aed298fd2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for arthash-0.3.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5d46aa6a75dc28fb9a3f1a062ebf7b31341d74838acf1cb8430f69f12084dfad
MD5 39b33fd2d801b5f6404c5070eb7d6ff8
BLAKE2b-256 ab1b08b967c6794b93d972900d35e9430bf4b1d119c40f7c2b299176d8535d26

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for arthash-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d20f5cf04dacbcbf26a5191e9bdd62bb9ef62012dc90a05c1294ef810ae686a
MD5 cfe6ac24e1a2a2921e8b4d2aaf5931d1
BLAKE2b-256 b7b3add167e2541260a722aa80ee25a2b5cc79796854bd83e014a887b41b7f00

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for arthash-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 61ab831f90470b3d2108bb54b0fb52127ccf0e819104acff1ed2444d8125e131
MD5 ea4667fddf4404249e0243de0588e591
BLAKE2b-256 1ccd526efb7e0eecb8a62b8701761c575cbe66d2645c485cb09ff7248bf1ebb5

See more details on using hashes here.

Provenance

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