Skip to main content

A truchet tiles generator

Project description

A truchet tiles generator

Creates a truchet pattern as a PNG bitmap.

Install

pip install truchet-tiling

Usage

import truchet_tiling.truchet_pattern as tp
from truchet_tiling.themes import RED_FLAMES 

image = tp.generate(
    width=700,
    height=500,
    colors = RED_FLAMES,
    directions='mixed',
    arcs_probability=1,
    stroke_color=0xFFFFFF,
    stroke_width=6
)

To try it in Jupyter Notebook:

import truchet_tiling.truchet_pattern as tp

# helper to display bitmap images
def display_image(image_bytes):
  from IPython.display import display, Image as IPImage
  display(IPImage(data=image_bytes.getvalue()))

image = tp.generate(width=800, height=600)
display_image(image)

Parameters:
width (int): Minimal width of the pattern.
height (int): Minimal height of the pattern.
cell_size (int): Size of the cell in the pattern.
arcs_probability (float): Probability of arcs in the pattern. Accepted float values in the range [0, 1].
directions (str): Direction of the pattern. Accepted values are ['mixed', 'horizontal', 'vertical'].
colors (List[int]): List of colors to use in the pattern. With Null a random color set will be used.
stroke_color (int): Color of the strokes.
stroke_width (int): Width of the strokes.

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

truchet_tiling-0.0.32.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

truchet_tiling-0.0.32-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file truchet_tiling-0.0.32.tar.gz.

File metadata

  • Download URL: truchet_tiling-0.0.32.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for truchet_tiling-0.0.32.tar.gz
Algorithm Hash digest
SHA256 629be0558d89c00449880c804491aac9b2fb0f5e776319dc9185cd699e9a5b41
MD5 991a36a42c6a9fdf15031124d09d082d
BLAKE2b-256 c1cd1f969176ec4356b62510c783f64c680245cc2603a1cd8bee288e306ec426

See more details on using hashes here.

File details

Details for the file truchet_tiling-0.0.32-py3-none-any.whl.

File metadata

File hashes

Hashes for truchet_tiling-0.0.32-py3-none-any.whl
Algorithm Hash digest
SHA256 13aa17f8c1843c601b1d34a80016c5dbedb0172649ca3297fc7b0d4979746435
MD5 38b6605ff5472c0681ce5d8d1fef2e1a
BLAKE2b-256 8a01cc57d31732bb0fe69edcd0c33e5926f2bf350cb39f88483f3e6872b40bac

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