The package comes with a standalone in-terminal image viewer based on the library.
The image viewer is started from the command line using either the
term-img command (only works if the Python scripts directory is on
python -m term_img.
The viewer accepts the following kinds of sources:
An image file on a local filesystem.
A directory on a local filesystem.
An Image URL.
Any other thing given as a source is simply reported as invalid.
The viewer can be used in two modes:
CLI modeIn this mode, images are directly printed to standard output.This mode is used whenever there is only a single image source or when the
--clioption is specified.
TUI modeIn this mode, a Terminal/Text-based User Interface is launched, within which images and directories can be browsed and viewed in different ways.This mode is used whenever there are multiple image sources or at least one directory source, or when the
--tuioption is specified.
--helpoption to see the usage info and help text.
Note that some options are only applicable to a specific mode. If used with the other mode, they’re simply ignored.
[N](where N is a number) behind their description, it indicates that the option has a footnote attached.
Standard output: This is used while the TUI is not launched.
TUI notification bar: This is used while the TUI is launched.
Notifications sent to the TUI’s notification bar automatically disappear after 5 seconds.
~/.term_img/term_img.logbut a different file can be specified (for a single session) using the
A log entry has the following format:
(<pid>) (<date> <time>) [<level>] <module>: <function>: <message>
pid: The process ID of the term-img session.
date and time: Current system date and time in the format
level: The level of the log entry, this indicates it’s importance.
module: The package sub-module from which it originated.
function: The function from which it originated.
Only present when running on Python 3.8+ and logging level is set to
message: The actual report describing the event that occured.
Certain logs and some extra info are only provided when logging level is set to
Log files are appended to, so it’s safe use the same file for multiple sessions.
Logs are rotated upon reaching a size of 1MiB.
Only the current and immediate previous log file are kept.
The Process ID of the
term-imginstance preceeds every log entry, so this can be used to distinguish and track logs from different sessions running simultaneously while using the same log file.
In no particular order:
Overlay support for
Open in external viewer
Grid cell animations
Pattern-based file and directory exclusion
Minimum and maximum file size
Optionally skipping symlinks
Grid cell showing number of subfolders
Frame duration adjustment per animated image
Alpha backaground adjustment per image
Parent directory path