Ripix
A Rich-compatible library for writing pixel images and other colourful grids to the terminal.
Installation
Get ripix from PyPI.
pip install ripix
Basic Usage
Images
Image from a file
You can load an image file from a path using from_image_path:
from ripix import Pixels
from rich.console import Console
console = Console()
pixels = Pixels.from_image_path("pokemon/bulbasaur.png")
console.print(pixels)
Pillow image object
You can create a PIL image object yourself and pass it in to from_image.
from ripix import Pixels
from rich.console import Console
from PIL import Image
console = Console()
with Image.open("path/to/image.png") as image:
pixels = Pixels.from_image(image)
console.print(pixels)
Using this approach means you can modify your PIL Image beforehard.
ASCII Art
You can quickly build shapes using a tool like asciiflow, and apply styles the ASCII characters. This provides a quick way of sketching out shapes.
from ripix import Pixels
from rich.console import Console
console = Console()
# Draw your shapes using any character you want
grid = """\
xx xx
ox ox
Ox Ox
xx xx
xxxxxxxxxxxxxxxxx
"""
# Map characters to different characters/styles
mapping = {
"x": Segment(" ", Style.parse("yellow on yellow")),
"o": Segment(" ", Style.parse("on white")),
"O": Segment(" ", Style.parse("on blue")),
}
pixels = Pixels.from_ascii(grid, mapping)
console.print(pixels)
Using with Textual
Pixels can be integrated into Textual
applications just like any other Rich renderable.
Metadata
Release files for ripix 2.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ripix-2.5.0.tar.gz | 3.4 kB | Without provenance | Details for ripix-2.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ripix-2.5.0-py3-none-any.whl | Python 3 | none | any | Details for ripix-2.5.0-py3-none-any.whl |
Total release size: 7.1 kB
Release files / ripix-2.5.0.tar.gz
| Download URL | ripix-2.5.0.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8693f499107687f7d7beb0be0c901bb4ab274460a76ccdda154d9018538ad011
|
|
BLAKE2b-256 checksum How to use checksums |
77c430bb1cab626efd47967eb28614566ccd75286b23b0da463e3b4dd2299bdb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Release files / ripix-2.5.0-py3-none-any.whl
| Download URL | ripix-2.5.0-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f62b4eba715d935f1717b1323723e94406b792c8d9757ef782277a6010e0af6f
|
|
BLAKE2b-256 checksum How to use checksums |
ac95154344ae9e65fe78cdbf0e2cc064db28f3b86ced1f257596667d20023372
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.13
|
Security for ripix 2.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.