Skip to content

JoshuaBragg/PTIR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 rendered
    • width : The width of the output (will be 2 * width characters wide)
    • height : The height of the output (will be height characters tall)
    • interp_method : Rescale interpolation method (Either 'bilinear' or 'nearest_neighbour')
    • only8Bit : If True the image will be rendered without any 24-bit colour
    • only24Bit : 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:

mountain original

24-bit:

mountain 24-bit

8-bit:

mountain 8-bit

Example #2

Original:

mario original

24-bit:

mario 24-bit

8-bit:

mario 8-bit

Dependencies

  • pillow
  • numpy

About

Python Terminal Image Renderer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages