python library and cli tool to convert images and videos to ascii.
Project description
asciipy
python library and cli tool to convert images and videos to ascii
Command line usage:
asciipy [input_file] [output_file] [width] (optional, default=80)
Command line examples:
-
image with default size:
asciipy test.png ascii.png
-
video with default size:
asciipy test.mp4 ascii.mp4
-
image with custom size:
asciipy test.png ascii.png 160
-
video with custom size:
asciipy test.mp4 ascii.mp4 160
Python usage:
asciipy provides three classes VideoConverter
, ImageConverter
, and BaseConverter
-
BaseConverter: provided for subclassing, and internal use
-
VideoConverter: takes four positional arguments,
input
,output
,width
, andprogress
-
- (os.PathLike, IOBase, str) input: input video to convert
-
- (os.PathLike, IOBase, str) output: destination of the converted video
-
- (int) width: desired width in ascii characters (height is implicit from the aspect ratio of the input)
-
- (bool) progress: if a progress indicator should be printed during conversion
-
ImageConverter: takes three positional arguments,
input
,output
, andwidth
-
- (os.PathLike, IOBase, str) input: input image to convert
-
- (os.PathLike, IOBase, str) output: destination of the converted image
-
- (int) width: desired width in ascii characters (height is implicit from the aspect ratio of the input)
both converter classes implement a .convert()
method, which takes no arguments, to start the conversion
Python examples:
image to ascii cli
from asciipy import ImageConverter
import sys
img = ImageConverter(sys.argv[1], './ascii.png')
img.convert()
print(f"{sys.argv[1]} converted and written to ./ascii.png")
need help?
-
or my guilded server (i'm often not online here)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for asciipy_any-0.1.1a6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd2c149d26af2da8e634c1853d0293e2dd2ef18340a21b775ddc2dba9facf6db |
|
MD5 | d99d3807ded181baf278d0d4c8d6bce0 |
|
BLAKE2b-256 | 443f4d9fd4112026e9e597435dc9ebe9208da293d787cfa7b1350eec0d8b541e |