# Brainfuck Art
![Python Versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12-blue)
![Test Status](https://github.com/pablomm/brainfuck-art/actions/workflows/tests.yml/badge.svg)
[![Documentation Status](https://readthedocs.org/projects/brainfuck-art/badge/?version=latest)](https://brainfuck-art.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://img.shields.io/pypi/v/brainfuck-art.svg)](https://pypi.org/project/brainfuck-art/)
Brainfuck Art is a Python library developed as a hobby project for generating images with hidden Brainfuck code. Inspired by htmlfuck, the library provides functionality to encode text into Brainfuck, convert images to ASCII art, and export the output in HTML, SVG, or PDF formats.
[![Coffee](https://raw.githubusercontent.com/pablomm/brainfuck-art/main/docs/assets/coffee.svg)](https://raw.githubusercontent.com/pablomm/brainfuck-art/main/docs/assets/coffee.svg)
## Example
You can download this example as pdf [Coffee-pdf](https://raw.githubusercontent.com/pablomm/brainfuck-art/main/docs/assets/coffee.pdf), copy the content (Ctrl+A) and paste in a brainfuck interpreter like [this one](https://copy.sh/brainfuck/) to recover the content.
## Features
- **Text to Brainfuck**: Convert any text into Brainfuck code.
- **ASCII Art Generation**: Transform images into color blocks.
- **Multiple Output Formats**: Export your creations as HTML, SVG, or PDF.
- **Command-Line Interface (CLI)**: Generate and export art from the terminal.
- **Python API**: Integrate Brainfuck Art into your Python projects with ease.
## Installation
To install Brainfuck Art, ensure you have Python 3.9 or higher, and run:
```bash
pip install brainfuck-art
```
## Command-Line Usage
You can use Brainfuck Art directly from the command line to create art with hidden Brainfuck code:
```bash
# Download the example image
curl -L -o coffee.png https://github.com/pablomm/brainfuck-art/blob/main/docs/assets/coffee.png\?raw\=true
# Generate Art with hidden text
brainfuck-art coffee.png -t "I love coffee" -o "coffee.pdf" -W 100 -H 100
```
### Main Options
- `-t`, `--text`: Text to encode as Brainfuck code.
- `-o`, `--output`: The output file name (with extension).
- `-W`, `--width`: Width of the output in characters.
- `-H`, `--height`: Height of the output in characters.
- `-f`, `--filetype`: File type for output (html, svg, pdf).
## Python API Usage
You can also use Brainfuck Art as a Python package to programmatically generate Brainfuck code, interpret it, and create visual art.
### Generate Brainfuck Code
```python
from brainfuck_art import text_to_bf
code = text_to_bf("brainfuck")
print(code)
```
Example output:
```
'>+++++++[>++++++++++++++<-]>.<++++[>++++<-]>.<++++[>----<-]>-.++++++++.+++++.--------.+++++++++++++++.<+++[>------<-]>.++++++++.'
```
### Execute Brainfuck Code
```python
from brainfuck_art import execute_bf
output, tape = execute_bf(code)
print(output) # Outputs: brainfuck
```
### Generate ASCII Art with Hidden Text
```python
from brainfuck_art import image_to_matrix, save_matrix_to_svg
text = "I love coffee"
text_matrix, color_matrix = image_to_matrix("coffee.png", text=text)
save_matrix_to_svg(text_matrix, color_matrix, output_file="coffee.svg")
```
You can also save the output in PDF or HTML formats using the same approach.
## License
Brainfuck Art is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
Raw data
{
"_id": null,
"home_page": null,
"name": "brainfuck-art",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "brainfuck, ASCII art, image processing, PDF generation, HTML generation, programming languages",
"author": null,
"author_email": "Pablo Marcos-Manch\u00f3n <pmarcos@ub.edu>",
"download_url": "https://files.pythonhosted.org/packages/5f/16/097e2af54ef65e7f109c2f2c61fdd93e67b0e34a854859465e45b130f846/brainfuck_art-1.0.1.tar.gz",
"platform": null,
"description": "# Brainfuck Art\n\n![Python Versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12-blue)\n![Test Status](https://github.com/pablomm/brainfuck-art/actions/workflows/tests.yml/badge.svg)\n[![Documentation Status](https://readthedocs.org/projects/brainfuck-art/badge/?version=latest)](https://brainfuck-art.readthedocs.io/en/latest/?badge=latest)\n[![PyPI version](https://img.shields.io/pypi/v/brainfuck-art.svg)](https://pypi.org/project/brainfuck-art/)\n\n\n\nBrainfuck Art is a Python library developed as a hobby project for generating images with hidden Brainfuck code. Inspired by htmlfuck, the library provides functionality to encode text into Brainfuck, convert images to ASCII art, and export the output in HTML, SVG, or PDF formats.\n\n[![Coffee](https://raw.githubusercontent.com/pablomm/brainfuck-art/main/docs/assets/coffee.svg)](https://raw.githubusercontent.com/pablomm/brainfuck-art/main/docs/assets/coffee.svg)\n\n## Example\n\n\nYou can download this example as pdf [Coffee-pdf](https://raw.githubusercontent.com/pablomm/brainfuck-art/main/docs/assets/coffee.pdf), copy the content (Ctrl+A) and paste in a brainfuck interpreter like [this one](https://copy.sh/brainfuck/) to recover the content.\n\n\n## Features\n\n- **Text to Brainfuck**: Convert any text into Brainfuck code.\n- **ASCII Art Generation**: Transform images into color blocks.\n- **Multiple Output Formats**: Export your creations as HTML, SVG, or PDF.\n- **Command-Line Interface (CLI)**: Generate and export art from the terminal.\n- **Python API**: Integrate Brainfuck Art into your Python projects with ease.\n\n## Installation\n\nTo install Brainfuck Art, ensure you have Python 3.9 or higher, and run:\n\n```bash\npip install brainfuck-art\n```\n\n## Command-Line Usage\n\nYou can use Brainfuck Art directly from the command line to create art with hidden Brainfuck code:\n\n```bash\n# Download the example image\ncurl -L -o coffee.png https://github.com/pablomm/brainfuck-art/blob/main/docs/assets/coffee.png\\?raw\\=true\n\n# Generate Art with hidden text\nbrainfuck-art coffee.png -t \"I love coffee\" -o \"coffee.pdf\" -W 100 -H 100\n```\n\n### Main Options\n\n- `-t`, `--text`: Text to encode as Brainfuck code.\n- `-o`, `--output`: The output file name (with extension).\n- `-W`, `--width`: Width of the output in characters.\n- `-H`, `--height`: Height of the output in characters.\n- `-f`, `--filetype`: File type for output (html, svg, pdf).\n\n## Python API Usage\n\nYou can also use Brainfuck Art as a Python package to programmatically generate Brainfuck code, interpret it, and create visual art.\n\n### Generate Brainfuck Code\n\n```python\nfrom brainfuck_art import text_to_bf\n\ncode = text_to_bf(\"brainfuck\")\nprint(code)\n```\n\nExample output:\n\n```\n'>+++++++[>++++++++++++++<-]>.<++++[>++++<-]>.<++++[>----<-]>-.++++++++.+++++.--------.+++++++++++++++.<+++[>------<-]>.++++++++.'\n```\n\n### Execute Brainfuck Code\n\n\n```python\nfrom brainfuck_art import execute_bf\n\noutput, tape = execute_bf(code)\nprint(output) # Outputs: brainfuck\n```\n\n### Generate ASCII Art with Hidden Text\n\n```python\nfrom brainfuck_art import image_to_matrix, save_matrix_to_svg\n\ntext = \"I love coffee\"\ntext_matrix, color_matrix = image_to_matrix(\"coffee.png\", text=text)\nsave_matrix_to_svg(text_matrix, color_matrix, output_file=\"coffee.svg\")\n```\n\nYou can also save the output in PDF or HTML formats using the same approach.\n\n\n\n## License\n\nBrainfuck Art is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library to generate Brainfuck code, convert images to ASCII art, and create PDFs or HTML outputs.",
"version": "1.0.1",
"project_urls": {
"repository": "https://github.com/pablomm/brainfuck-art/"
},
"split_keywords": [
"brainfuck",
" ascii art",
" image processing",
" pdf generation",
" html generation",
" programming languages"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a132602625456c7a8aaed200f281368a493023740a37e4ae8a990b6d5ccecc64",
"md5": "6019f1a4fbd4144f0d4a8aa8d2075dee",
"sha256": "160bfa7d8a8cc0153d48efee50daabcca4ec55f7b83301fff49c75e4e2b7cc44"
},
"downloads": -1,
"filename": "brainfuck_art-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6019f1a4fbd4144f0d4a8aa8d2075dee",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 14946,
"upload_time": "2024-08-14T00:10:38",
"upload_time_iso_8601": "2024-08-14T00:10:38.267873Z",
"url": "https://files.pythonhosted.org/packages/a1/32/602625456c7a8aaed200f281368a493023740a37e4ae8a990b6d5ccecc64/brainfuck_art-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5f16097e2af54ef65e7f109c2f2c61fdd93e67b0e34a854859465e45b130f846",
"md5": "831b7fc7dea9cfe28262877bc30b1a3b",
"sha256": "75628d556eb840c32175fe159a5acf214489fa616bf2835c8895bcaeeab65914"
},
"downloads": -1,
"filename": "brainfuck_art-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "831b7fc7dea9cfe28262877bc30b1a3b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 14678,
"upload_time": "2024-08-14T00:10:40",
"upload_time_iso_8601": "2024-08-14T00:10:40.416110Z",
"url": "https://files.pythonhosted.org/packages/5f/16/097e2af54ef65e7f109c2f2c61fdd93e67b0e34a854859465e45b130f846/brainfuck_art-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-14 00:10:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pablomm",
"github_project": "brainfuck-art",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "brainfuck-art"
}