Skip to main content

small tool to transfer image between cmd char

Project description



this module can change image to char[], can be printed at console beautiful




this QR Code can even be recognized when density>=0.6

console tool

right click the title bar of cmd, and choose properties, then you can change the size of the fonts in order to fully show the char image


pip install image2char
pip3 install image2char

input args and get chars

imagetochar -h

imagetochar input1.jpg 

imagetochar input2.png -d 0.6 -r -s 1 -c "█ " //this is QR Code

imagetochar -u "" -d 0.7 -w 300 -r //this is Url Image


usage: [-h] [-d DENTISY] [-s SCALE] [-r] [-c CHARSET] [-u]
                     [-w WIDTH]

welcome to imagetochar cmd tool 你可以使用这个工具将本地/网络的图片转成字符画

positional arguments:

optional arguments:
  -h, --help            show this help message and exit
  -d DENTISY, --dentisy DENTISY
                        dentisy, 分辨率, 取值0-1 默认为0.5
  -s SCALE, --scale SCALE
                        scale, 字符集高宽比, 默认为2
  -r, --reversed        reversed, 是否翻转黑白
  -c CHARSET, --charset CHARSET
                        charset, 字符集, 默认使用经典ascii字符集
  -u, --url             是否使用url, 将image_path路径设定为url
  -w WIDTH, --width WIDTH


from image2char import tool
from PIL import Image
import logging

img_path1 = 'image2char/input1.jpg'
img_path2 = 'image2char/input2.png'

if __name__ == '__main__':

    img1 =
    img2 =
    matrix = tool.to_chars(img1, density=0.5, scale=2, reversed=True)'matrix: %d, %d' % (len(matrix), len(matrix[0])))
    for i in range(len(matrix)):

    char_list = '''█ '''
    scanner = tool.get_scanner(density=0.6, scale=1)
    # reversed=True: in windows console, the char is white
    scanner.scan(img2, reversed=True, char_list=char_list)

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

image2char-0.1.2.tar.gz (15.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page