项目
在 GitHub 查看
hit9/img2txt
关于
将图像转换为支持颜色的 ASCII 文本,可输出为 HTML 或 ANSI 终端格式。
设计与媒体实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文img2txt
Image to Ascii Text, can output to html or ansi terminal.
See also gif2txt for animated version.
Example

img2txt.py jiaozhu.jpg > without-color.html: demoimg2txt.py jiaozhu.jpg --dither > without-color-dither.html: demoimg2txt.py jiaozhu.jpg --color > with-color.html: demoimg2txt.py jiaozhu.jpg --ansi: demo
Installation
$ virtualenv venv
$ . venv/bin/activate
(venv)$ pip install img2txt.py
Usage
Usage:
img2txt.py <imgfile> [--maxLen=<n>] [--fontSize=<n>] [--color] [--ansi] [--bgcolor=<#RRGGBB>] [--targetAspect=<n>] [--antialias] [--dither]
img2txt.py (-h | --help)
Options:
-h --help show this screen.
--ansi output an ANSI rendering of the image
--color output a colored HTML rendering of the image.
--antialias causes any resizing of the image to use antialiasing
--dither dither the colors to web palette. Useful when converting
images to ANSI (which has a limited color palette)
--fontSize=<n> sets font size (in pixels) when outputting HTML,
default: 7
--maxLen=<n> resize image so that larger of width or height matches
maxLen, default: 100px
--bgcolor=<#RRGGBB> if specified, is blended with transparent pixels to
produce the output. In ansi case, if no bgcolor set, a
fully transparent pixel is not drawn at all, partially
transparent pixels drawn as if opaque
--targetAspect=<n> resize image to this ratio of width to height. Default is
1.0 (no resize). For a typical terminal where height of a
character is 2x its width, you might want to try 0.5 here
Authors
- @EdRowe (#4, #7)
- @shakib609 (#10)
- @mattaudesse (#11)
- @hit9
License
BSD.
探索相关项目
加载中…