Module ops

Module ops 

Source
Expand description

Main functions doing actual work.

Use guess_format() to get the image format from a path, then read the image using load_image() to the size given by image_resized_size(), resize it to terminal size with resize_image() and display it with write_[no_]ansi[_truecolor](), or display it yourself with approximations from create_colourtable().

Functions§

create_colourtable
Create a line-major table of (upper, lower) colour approximation indices given the supported colours therefor.
guess_format
Guess the image format from its extension or magic.
image_resized_size
Get the image size to downscale to, given its size, the terminal’s size and whether to preserve its aspect.
load_image
Load an image from the specified file as the specified format.
resize_image
Resize the specified image to the specified size.
write_ansi
Display the specified image approximating it to the specified colours in the default console using ANSI escape codes.
write_ansi_truecolor
Display the specified image in the default console using ANSI 24-bit escape colour codes.
write_no_ansi
Display the specified image in the default console using WinAPI.