Skip to main content

Image/Video to ASCII conversion

Project description

Image2ASCII

img2ascii is a library written in python which can convert image or video files to ASCII

Option list:

  • -h or --help : To generate the help text
  • -m or --mode : Select the mode of operation -- t for text, i for image, v for video and w for webcam input
  • -c or --color : Optional parameter to select color mode. 0 - B/W, 1 - Grayscale and 2 - RGB. Default color mode is B/W
  • -k or --kernel : Optional parameter to set the kernel size, default is 7px
  • -d or --density : Optional parameter to set the ASCII text density on image, default is 0.3 units; Range - (0,1) (exclusive)
  • -i or --ifile : Path to the input file for image and video modes
  • -o or --ofile : Path to the output file for image and video modes
  • -s or --cam_source : Camera to be used for webcam mode. Use 0,1,2,3... to select cameras connected to the PC. Default value is 0
  • -f or --fancy : Fancy mode :). (Color mode defaults to RGB)

Installation:

  • Direct install : - pip install img2ascii
  • From Git :
    1. git clone https://github.com/gopaljigaur/img2ascii.git
    2. cd img2ascii
    3. python3 setup.py build
    4. python3 setup.py install

Usage :

  • For text : img2ascii.py -m <mode>[t=text] -i <inputfile> -o <outputfile> -k <kernel_size>[optional] -d <text_density>[optional]
  • For image : img2ascii.py -m <mode>[i=image] -c[color mode (optional)] -i <inputfile> -o <outputfile> -k <kernel_size>[optional] -d <text_density>[optional] -f <fancy_mode>[optional]
  • For video : img2ascii.py -m <mode>[v=video] -c[color mode (optional)] -i <inputfile> -o <outputfile> -k <kernel_size>[optional] -d <text_density>[optional] -f <fancy_mode>[optional]
  • For webcam : img2ascii.py -m <mode>[w=webcam] -c[color mode (optional)] -k <kernel_size>[optional] -d <text_density>[optional -s <source_camera (0,1,2...)>[optional] -f <fancy_mode>[optional]

Usage in python code:

  • For image : from img2ascii import text_gen
    then text_gen.generate_ascii_t(str inputfile, str outputfile, int kernel [o], float density [o])
  • For image : from img2ascii import image_gen
    then image_gen.generate_ascii_i(str inputfile, str outputfile, int color [o], int kernel [o], float density [o], bool fancy [o])
  • For video : from img2ascii import video_gen
    then video_gen.generate_ascii_v(str inputfile, str outputfile, int color [o], int kernel [o], float density [o], bool fancy [o])
  • For webcam : from img2ascii import image_gen
    then image_gen.generate_ascii_w(int color [o], int kernel [o], float density [o], int cam_source [o], str cam_name [o], bool fancy [o])

NOTE : Parameters followed by [o] are optional

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

img2ascii-1.1.6.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

img2ascii-1.1.6-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file img2ascii-1.1.6.tar.gz.

File metadata

  • Download URL: img2ascii-1.1.6.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1

File hashes

Hashes for img2ascii-1.1.6.tar.gz
Algorithm Hash digest
SHA256 321b3a8995728ff7d3228ae60a6c3e06b04cc9f19234bd1f308777eaa513f304
MD5 93c3e1b5bcc9be06e891400be555c9ca
BLAKE2b-256 bf229400c1679e94358c5b0d8815e1df5740cae068b238bdd7200c8e04f6978e

See more details on using hashes here.

File details

Details for the file img2ascii-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: img2ascii-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1

File hashes

Hashes for img2ascii-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 80e70c4f5077d77bd8fd22a29765ad6318cc7f889661a617373a4e28cf0c4fc6
MD5 204b92fe23db0d462076bf039707e070
BLAKE2b-256 f49e18f036676cb080d7212493b3f89dcddb9f5f05f03d00cb2087763df3e650

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page