truchet-tiling


Nametruchet-tiling JSON
Version 0.0.32 PyPI version JSON
download
home_pageNone
SummaryA truchet tiles generator
upload_time2025-01-07 11:12:52
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords generative art pattern tiling truchet
VCS
bugtrack_url
requirements cairocffi cairosvg cffi cssselect2 defusedxml numpy perlin-noise pillow pycairo pycparser tinycss2 webencodings
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # A truchet tiles generator

Creates a truchet pattern as a PNG bitmap.

![](https://raw.githubusercontent.com/con-lit/pattern_generator/refs/heads/main/examples/images/pattern01.png)

## Install

`pip install truchet-tiling`

## Usage

```python
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:

```python
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.  

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "truchet-tiling",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "generative art, pattern, tiling, truchet",
    "author": null,
    "author_email": "Constantin Litvak <mail@consta.de>",
    "download_url": "https://files.pythonhosted.org/packages/c1/cd/1f969176ec4356b62510c783f64c680245cc2603a1cd8bee288e306ec426/truchet_tiling-0.0.32.tar.gz",
    "platform": null,
    "description": "# A truchet tiles generator\n\nCreates a truchet pattern as a PNG bitmap.\n\n![](https://raw.githubusercontent.com/con-lit/pattern_generator/refs/heads/main/examples/images/pattern01.png)\n\n## Install\n\n`pip install truchet-tiling`\n\n## Usage\n\n```python\nimport truchet_tiling.truchet_pattern as tp\nfrom truchet_tiling.themes import RED_FLAMES \n\nimage = tp.generate(\n    width=700,\n    height=500,\n    colors = RED_FLAMES,\n    directions='mixed',\n    arcs_probability=1,\n    stroke_color=0xFFFFFF,\n    stroke_width=6\n)\n```\n\nTo try it in Jupyter Notebook:\n\n```python\nimport truchet_tiling.truchet_pattern as tp\n\n# helper to display bitmap images\ndef display_image(image_bytes):\n  from IPython.display import display, Image as IPImage\n  display(IPImage(data=image_bytes.getvalue()))\n\nimage = tp.generate(width=800, height=600)\ndisplay_image(image)\n```\n\nParameters:  \n**width (int)**: Minimal width of the pattern.  \n**height (int)**: Minimal height of the pattern.  \n**cell_size (int)**: Size of the cell in the pattern.  \n**arcs_probability (float)**: Probability of arcs in the pattern. Accepted float values in the range [0, 1].  \n**directions (str)**: Direction of the pattern. Accepted values are ['mixed', 'horizontal', 'vertical'].  \n**colors (List[int])**: List of colors to use in the pattern. With Null a random color set will be used.  \n**stroke_color (int)**: Color of the strokes.  \n**stroke_width (int)**: Width of the strokes.  \n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A truchet tiles generator",
    "version": "0.0.32",
    "project_urls": {
        "Homepage": "https://github.com/con-lit/pattern_generator",
        "Issues": "https://github.com/con-lit/pattern_generator/issues"
    },
    "split_keywords": [
        "generative art",
        " pattern",
        " tiling",
        " truchet"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a01cc57d31732bb0fe69edcd0c33e5926f2bf350cb39f88483f3e6872b40bac",
                "md5": "38b6605ff5472c0681ce5d8d1fef2e1a",
                "sha256": "13aa17f8c1843c601b1d34a80016c5dbedb0172649ca3297fc7b0d4979746435"
            },
            "downloads": -1,
            "filename": "truchet_tiling-0.0.32-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "38b6605ff5472c0681ce5d8d1fef2e1a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 18433,
            "upload_time": "2025-01-07T11:12:50",
            "upload_time_iso_8601": "2025-01-07T11:12:50.060867Z",
            "url": "https://files.pythonhosted.org/packages/8a/01/cc57d31732bb0fe69edcd0c33e5926f2bf350cb39f88483f3e6872b40bac/truchet_tiling-0.0.32-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1cd1f969176ec4356b62510c783f64c680245cc2603a1cd8bee288e306ec426",
                "md5": "991a36a42c6a9fdf15031124d09d082d",
                "sha256": "629be0558d89c00449880c804491aac9b2fb0f5e776319dc9185cd699e9a5b41"
            },
            "downloads": -1,
            "filename": "truchet_tiling-0.0.32.tar.gz",
            "has_sig": false,
            "md5_digest": "991a36a42c6a9fdf15031124d09d082d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11439,
            "upload_time": "2025-01-07T11:12:52",
            "upload_time_iso_8601": "2025-01-07T11:12:52.428115Z",
            "url": "https://files.pythonhosted.org/packages/c1/cd/1f969176ec4356b62510c783f64c680245cc2603a1cd8bee288e306ec426/truchet_tiling-0.0.32.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-07 11:12:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "con-lit",
    "github_project": "pattern_generator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "cairocffi",
            "specs": [
                [
                    "==",
                    "1.7.1"
                ]
            ]
        },
        {
            "name": "cairosvg",
            "specs": [
                [
                    "==",
                    "2.7.1"
                ]
            ]
        },
        {
            "name": "cffi",
            "specs": [
                [
                    "==",
                    "1.17.1"
                ]
            ]
        },
        {
            "name": "cssselect2",
            "specs": [
                [
                    "==",
                    "0.7.0"
                ]
            ]
        },
        {
            "name": "defusedxml",
            "specs": [
                [
                    "==",
                    "0.7.1"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "2.2.1"
                ]
            ]
        },
        {
            "name": "perlin-noise",
            "specs": [
                [
                    "==",
                    "1.13"
                ]
            ]
        },
        {
            "name": "pillow",
            "specs": [
                [
                    "==",
                    "11.1.0"
                ]
            ]
        },
        {
            "name": "pycairo",
            "specs": [
                [
                    "==",
                    "1.27.0"
                ]
            ]
        },
        {
            "name": "pycparser",
            "specs": [
                [
                    "==",
                    "2.22"
                ]
            ]
        },
        {
            "name": "tinycss2",
            "specs": [
                [
                    "==",
                    "1.4.0"
                ]
            ]
        },
        {
            "name": "webencodings",
            "specs": [
                [
                    "==",
                    "0.5.1"
                ]
            ]
        }
    ],
    "lcname": "truchet-tiling"
}
        
Elapsed time: 0.46266s