consoleimages
Reads image formats and prints ascii colour text to console
Create an instance of the image class passing the path of a image as an argument.
Instance arguments:
- width (of astext string)
- height (of astext string)
- aspect_ratio (width/height)
- astext (string that gets printed to the console)
- name (the name of the image file)
- display() (pass a file to write to, otherwise sys.stdout)
Example:
from os import get_terminal_size, listdir
from os.path import isfile, join
from time import sleep
from consoleimages import image
def clear():
from os import system
from sys import platform
system("cls" if platform == "win32" else "clear") # clears the console
images = {}
while True:
for imagename in [f for f in listdir("images/") if isfile(join("images/", f))]: # open the 'images/' directory and get all the file names inside.
clear() # clear console
images[imagename] = image("images/" + imagename, get_terminal_size()[1] - 4) # create instance of image class
print(images[imagename].name) # print the name of the image in that instance
images[imagename].display() # print the image
print(images[imagename].width, images[imagename].height, sep=" x ", end=" (" + str(images[imagename].aspect_ratio) + ")\n") # print the width, height and aspect ratio
sleep(2) # wait 2 seconds
Release files for consoleimages 1.0.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 | |
|---|---|---|---|
| consoleimages-1.0.0.tar.gz | 2.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| consoleimages-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.3 kB
Release files / consoleimages-1.0.0.tar.gz
| Download URL | consoleimages-1.0.0.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b882b4df13408dc6ab41d2748f3cf1ff8ac2b98c1ba60df01419e754da216a1
|
|
BLAKE2b-256 checksum How to use checksums |
207e428f5d29d1533c1fb25b51cae1d3e20349f0ef9ade8711b5f33083b5b9b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.5
|
Release files / consoleimages-1.0.0-py3-none-any.whl
| Download URL | consoleimages-1.0.0-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3231a6ee0bf9f779c9d8c58f582f19387c4fad5b37a4da6628744733ec63d423
|
|
BLAKE2b-256 checksum How to use checksums |
ad475a5f144c4f17de2ef41498ed43805fe658583ec11daea4e833daf11f256d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.8.0 tqdm/4.48.2 CPython/3.8.5
|