← 返回命令列表

Linux command

img2txt 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

img2txt -W [10] [path/to/image]

Example

img2txt -H [5] [path/to/image]

Example

img2txt -x [12] [path/to/image]

Example

img2txt -y [14] [path/to/image]

Example

img2txt -f html [path/to/image] > [output.html]

说明

img2txt converts images to colored text-based art using character patterns and terminal colors. It is part of the libcaca library. It supports PNG, JPEG, GIF, BMP, and other common image formats. Default output is 60 columns wide with height calculated to preserve aspect ratio. The tool can produce output in various formats including ANSI terminal codes, HTML, IRC color codes, and plain text. The resulting ASCII art can be displayed in terminals or embedded in documents.

参数

-W, --width _COLS_
Set output width in columns
-H, --height _LINES_
Set output height in lines
-x, --font-width _PIXELS_
Set assumed font width for aspect ratio (default 6)
-y, --font-height _PIXELS_
Set assumed font height for aspect ratio (default 10)
-b, --brightness _VALUE_
Adjust brightness (default 1.0)
-c, --contrast _VALUE_
Adjust contrast (default 1.0)
-g, --gamma _VALUE_
Adjust gamma (default 1.0)
-d, --dither _ALGORITHM_
Dithering algorithm (none, ordered2, ordered4, ordered8, random, fstein)
-f, --format _FORMAT_
Output format: ansi, utf8, html, html3, irc, bbfr, ps, svg, tga, caca (default ansi).
-v, --version
Show version information.
-h, --help
Display help.

FAQ

What is the img2txt command used for?

img2txt converts images to colored text-based art using character patterns and terminal colors. It is part of the libcaca library. It supports PNG, JPEG, GIF, BMP, and other common image formats. Default output is 60 columns wide with height calculated to preserve aspect ratio. The tool can produce output in various formats including ANSI terminal codes, HTML, IRC color codes, and plain text. The resulting ASCII art can be displayed in terminals or embedded in documents.

How do I run a basic img2txt example?

Run `img2txt -W [10] [path/to/image]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -W, --width _COLS_ do in img2txt?

Set output width in columns