Skip to main content

Generate coin pile PNG images from generic values.

Project description

coinpiles

Generate a gold coin pile image from a number.

Quick start

pip install coinpiles
coinpiles generate --coins 145 --output out.png

Python API

from coinpiles import generate_image, save_png

img = generate_image(coins=145)
img.save("out.png")

img2 = generate_image(coins=80, random_seed=42, pile_spacing=5.0)

save_png("out.png", coins=80)

generate_image(...) accepts:

argument default description
coins required number of coins to render
width 512 canvas width in pixels before crop
height 512 canvas height in pixels before crop
random_seed 42 seed for deterministic layout
pile_spacing 5.0 distance between pile anchor points; lower = denser
new_pile_probability 0.1 chance of starting a new pile at each growth step
position_weight_multiplier 2.0 bias toward placing coins in higher pile positions
height_weight_multiplier -1.0 bias against already tall piles to spread growth

CLI usage

coinpiles generate --coins 80 --pile-spacing 4.8 --random-seed 42 --output out.png

Custom sprite images

You can provide your own sprite files by path (top, layer_even, layer_odd, bottom).

Python API:

from coinpiles import save_png

save_png(
    "out_custom.png",
    coins=80,
    top_path="my_assets/top.png",
    layer_even_path="my_assets/layer_even.png",
    layer_odd_path="my_assets/layer_odd.png",
    bottom_path="my_assets/bottom.png",
)

CLI:

coinpiles generate --coins 80 --top-path "my_assets/top.png" --layer-even-path "my_assets/layer_even.png" --layer-odd-path "my_assets/layer_odd.png" --bottom-path "my_assets/bottom.png" --output out_custom_paths.png

Example output

coinpiles example

Determinism

Rendering is deterministic by default. coinpiles uses a fixed RNG seed, so the same input produces the same image output.

Scope

Rendering is the only concern — how you get the coin count is up to you.

Hardware-specific output (for example Raspberry Pi e-paper display) should live in a separate adapter project.

Assets

Coin sprites in coinpiles/coinpiles/assets/ are original artwork created by the project author and are licensed under the same MIT license as this project.

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

coinpiles-0.2.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

coinpiles-0.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file coinpiles-0.2.0.tar.gz.

File metadata

  • Download URL: coinpiles-0.2.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for coinpiles-0.2.0.tar.gz
Algorithm Hash digest
SHA256 45090363d3686fcb8cbb74613a9e87e4fe6f616572a70bf98a20fc36c521b359
MD5 89608ce0c60c35bfd8507e769147b5dd
BLAKE2b-256 75cf892d5627f78252df5b23078a72c51f65b436558c417b05943f62bd1f505e

See more details on using hashes here.

File details

Details for the file coinpiles-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: coinpiles-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for coinpiles-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ab2f90d24a5ff2297d24e3f6a79c5f1ebdf3586d3715ace45517a9a659c43a7
MD5 0af3d3484305bbaf96550cc721a9622b
BLAKE2b-256 2469f402f6d9457cfc1a9df2b634835960b51f1567bf75e259c924eb31d1c1f0

See more details on using hashes here.

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