picturizer

Transform picture into picture-like string


Keywords
image, string, to, Monsoir
License
MIT
Install
pip install picturizer==1.0.1

Documentation

图片转字符画 Picturizer

将图片转换为字符画

运行

  1. 创建并激活虚拟环境,使用的是 Python 3.6.2 开发

    virtualenv --no-site-packages env
    source env/bin/activate
    
  2. 安装

    pip install picturizer
  3. 使用

    picturize -i ~/Downloads/a_picture.jpg -o ~/Downloads/result.txt -s 1.0

帮助

picturize -h
usage: picturize [-h] -i [source_path] [-o [store_path]] [-s [a_scale]]

optional arguments:
  -h, --help            show this help message and exit
  -i [source_path], --input [source_path]
                        input file
  -o [store_path], --output [store_path]
                        output file
  -s [a_scale], --scale [a_scale]
                        scale of the picture, should be 0 < scale <= 1

重点

RGB 与灰度值的转换公式

  • 心理学公式

    Gray = R*0.299 + G*0.587 + B*0.114
    
  • 计算机效率处理公式

    Gray = (R*19595 + G*38469 + B*7472) >> 16
    

References