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.1.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.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coinpiles-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 fe5d88b35b9d8258c7e961c025e10c80d7144a7469918e750fa2fea24c50e263
MD5 390266f94ff382c9455d186365e8bbd1
BLAKE2b-256 8d09ad56f6ecc8a18751ee77d406245669189b50cb860be49767e0714ff2006d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coinpiles-0.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c5ab2b5c11db12926ef680fac0a15a76a1e27a794e47d6444d059bee053546a2
MD5 bb0fd04b3deab112a0c93d2c41c0b2c2
BLAKE2b-256 bc7738cbca50c41f3a814d00833597e8ff991477837ce5cce37378f9733c5b7a

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