PTIR (Python Terminal Image Renderer)
Installation
pip install ptir
Usage
import ptir
image_path = ...
# Render the given image
ptir.render(image_path)
# Display entire 8-bit colour space
ptir.view8BitPalette()
# Display entire 24-bit colour space
ptir.view24BitPalette()
Documentation
ptir.render(image_path, width=100, height=100, interp_method='bilinear', only8Bit=False, only24Bit=False)image_path: Path to the image that will be renderedwidth: The width of the output (will be 2 *widthcharacters wide)height: The height of the output (will beheightcharacters tall)interp_method: Rescale interpolation method (Either 'bilinear' or 'nearest_neighbour')only8Bit: If True the image will be rendered without any 24-bit colouronly24Bit: If True the image will be rendered without any 8-bit colour. This mode is recommended to be used only if you are confident that the terminal will support 24-bit colour but are unsure if unicode characters are supported by the terminal font
- Not all terminal windows support 24-bit colour (Visit this website for more information on TrueColour support)
- The macOS default Terminal.app DOES NOT support 24-bit colour!
- By default the image will be rendered with two layers, 24-bit foreground to display properly on supporting terminals, and a 8-bit background to display if 24-bit colour is not available
Example #1
Original:
24-bit:
8-bit:
Example #2
Original:
24-bit:
8-bit:
Dependencies
pillownumpy
Release files for ptir 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ptir-1.2.1.tar.gz | 3.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ptir-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.1 kB
Release files / ptir-1.2.1.tar.gz
| Download URL | ptir-1.2.1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4aead69dde4abc520d5acf233a87508864c6d100dc2599d4a0fe6c8e23b2cb21
|
|
BLAKE2b-256 checksum How to use checksums |
2026805edf596e1fe44fa350afb2ad8d65af508c85b8862b4d190009ac510840
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
|
Release files / ptir-1.2.1-py3-none-any.whl
| Download URL | ptir-1.2.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c24fa5a2ef73524ef3cb64928a134d0b06f64e81e435f75a081afd8356d68b35
|
|
BLAKE2b-256 checksum How to use checksums |
ee758f8ac43bfdd6fcfcf287102d98345abe3fd99bb478e947b8d42fa91590d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5
|