ASCII-Block is a Python script that converts text into binary art using a customizable font. By rendering the text onto a Pillow canvas, this tool creates a character grid where each character represents the text or fills the background. Perfect for creating unique visual representations of text, with flexible options for output.
ASCII-Block is a powerful Python script designed to transform text into stunning binary art using real fonts. Each character in the output represents a pixel drawn on a Pillow canvas, providing a unique aesthetic for textual representation.
pipTo run the script, use the command:
python generate.py [options] [TEXT]
Where the default TEXT is set to CODE.
| Short | Long | Default | Description |
|---|---|---|---|
-w | --width | terminal width | Specify the output width in characters. |
-h | --height | width / 4 | Specify the output height in characters |
-f | --foreground | 0 | Characters used for the text pixels. Supports ANSI codes. |
-b | --background | 1 | Characters for the background pixels. Supports ANSI codes. |
-p | --padding | 0 | Padding in characters around the text. |
-x | --font | auto-detect | Provide the path to a desired font file. |
-o | --output | stdout | Specify where to write output (default is stdout). |
--format | text | Choose between text or svg output formats. | |
--fcolor | #000000 | Foreground character color in SVG (hex code). | |
--bcolor | #cccccc | Background character color in SVG (hex code). | |
--svg-background | #ffffff | SVG rectangle background color (hex code). | |
--help | Display a help message. |
Basic Usage: Generate default output with:
python generate.py
Custom Characters: Change text and background with:
python generate.py -f '#' -b '.' HELLO
Coloured Output: Create red text on a grey background:
python generate.py -f '\033[31m0\033[0m' -b '\033[90m1\033[0m'
SVG Generation: Output your art as an SVG file:
python generate.py --format svg -o output.svg CODE
ASCII-Block brings a creative approach to turning text into art, leveraging Python's capabilities for users looking for unique visual expressions.
No comments yet.
Sign in to be the first to comment.