百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

ascii-image-converter

> 数据库
开源

一个跨平台命令行工具,可将图像转换为 ASCII 图像并在控制台上打印。现在支持盲文艺术!

3.5K stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个跨平台命令行工具,可将图像转换为 ASCII 图像并在控制台上打印。现在支持盲文艺术!

# ascii-image-converter ascii-image-converter is a command-line tool that converts images into ascii art and prints them out onto the console. Available on Windows, Linux and macOS. Now supports braille art! Input formats currently supported: * JPEG/JPG * PNG * BMP * WEBP * TIFF/TIF * GIF

## Table of Contents - [Installation](#installation) * [Debian / Ubuntu-based](#debian-or-ubuntu-based-distros) * [Homebrew](#homebrew) * [AUR](#aur) * [Scoop](#scoop) * [Snap](#snap) * [Go](#go) * [Linux (binaries)](#linux) * [Windows (binaries)](#windows) - [CLI Usage](#cli-usage) * [Flags](#flags) - [Library Usage](#library-usage) - [Contributing](#contributing) - [Packages Used](#packages-used) - [License](#license) ## Installation ### Debian or Ubuntu-based Distros Execute the following commands in order: ``` echo 'deb [trusted=yes] https://apt.fury.io/ascii-image-converter/ /' | sudo tee /etc/apt/sources.list.d/ascii-image-converter.list ``` ``` sudo apt update ``` ``` sudo apt install -y ascii-image-converter ```
To remove the package source (which means you won't be getting any further updates), execute this command: ``` sudo rm -v /etc/apt/sources.list.d/ascii-image-converter.list ```
### Homebrew Installation with homebrew is available for both Linux and macOS. ``` brew install TheZoraiz/ascii-image-converter/ascii-image-converter ``` [Link to homebrew repository](https://github.com/TheZoraiz/homebrew-ascii-image-converter)
### AUR The AUR repo is maintained by [magnus-tesshu](https://aur.archlinux.org/account/magnus-tesshu) Standard way: ``` git clone https://aur.archlinux.org/ascii-image-converter-git.git ``` ``` cd ascii-image-converter-git/ ``` ``` makepkg -si ``` AUR helper: ``` -S ascii-image-converter-git ```
### Scoop The scoop manifest is maintained by [brian6932](https://github.com/brian6932) ``` scoop install ascii-image-converter ```
### Snap > **Note:** The snap will not have access to hidden files and files outside the $HOME directory. This includes write access for saving ascii art as well. ``` sudo snap install ascii-image-converter ``` Visit [the app's snap store listing](https://snapcraft.io/ascii-image-converter) for instructions regarding enabling snapd on your distribution.
### Go ``` go install github.com/TheZoraiz/ascii-image-converter@latest ```
For physically installing the binaries, follow the steps with respect to your OS. ### Linux Download the archive for your distribution's architecture [here](https://github.com/TheZoraiz/ascii-image-converter/releases/latest), extract it, and open the extracted directory. Now, open a terminal in the same directory and execute this command: ``` sudo cp ascii-image-converter /usr/local/bin/ ``` Now you can use ascii-image-converter in the terminal. Execute `ascii-image-converter -h` for more details. ### Windows You will need to set an Environment Variable to the folder the ascii-image-converter.exe executable is placed in to be able to use it in the command prompt. Follow the instructions in case of confusion: Download the archive for your Windows architecture [here](https://github.com/TheZoraiz/ascii-image-converter/releases/latest), extract it, and open the extracted folder. Now, copy the folder path from the top of the file explorer and follow these instructions: * In Search, search for and then select: Advanced System Settings * Click Environment Variables. In the section User Variables find the Path environment variable and select it. Click "Edit". * In the Edit Environment Variable window, click "New" and then paste the path of the folder that you copied initially. * Click "Ok" on all open windows. Now, restart any open command prompt and execute `ascii-image-converter -h` for more details.
## CLI Usage > **Note:** Decrease font size or increase terminal width (like zooming out) for maximum quality ascii art The basic usage for converting an image into ascii art is as follows. You can also supply multiple image paths and urls as well as a GIF. ``` ascii-image-converter [image paths/urls] ``` Example: ``` ascii-image-converter myImage.jpeg ``` > **Note:** Piped binary input is also supported > ``` > cat myImage.png | ascii-image-converter - > ``` ### Flags #### --color OR -C > **Note:** Your terminal must support 24-bit or 8-bit colors for appropriate results. If 24-bit colors aren't supported, 8-bit color escape codes will be used Display ascii art with the colors from original image. ``` ascii-image-converter [image paths/urls] -C # Or ascii-image-converter [image paths/urls] --color ```

#### --braille OR -b > **Note:** Braille pattern display heavily depends on which terminal or font you're using. In windows, try changing the font from command prompt properties if braille characters don't display Use braille characters instead of ascii. For this flag, your terminal must support braille patters (UTF-8) properly. Otherwise, you may encounter problems with colored or even uncolored braille art. ``` ascii-image-converter [image paths/urls] -b # Or ascii-image-converter [image paths/urls] --braille ```

#### --threshold Set threshold value to compare for braille art when converting each pixel into a dot. Value must be between 0 and 255. Example: ``` ascii-image-converter [image paths/urls] -b --threshold 170 ``` #### --dither Apply dithering on image to make braille art more visible. Since braille dots can only be on or off, dithering images makes them more visible in braille art. Example: ``` ascii-image-converter [image paths/urls] -b --dither ```

#### --color-bg If any of the coloring flags is passed, this flag will transfer its color to each character's background. instead of foreground. However, this option isn't available for `--save-img` and `--save-gif` ``` ascii-image-converter [image paths/urls] -C --color-bg ``` #### --dimensions OR -d > **Note:** Don't immediately append another flag with -d Set the width and height for ascii art in CHARACTER lengths. ``` ascii-image-converter [image paths/urls] -d , # Or ascii-image-converter [image paths/urls] --dimensions , ``` Example: ``` ascii-image-converter [image paths/urls] -d 60,30 ```

#### --width OR -W > **Note:** Don't immediately append another flag with -W Set width of ascii art. Height is calculated according to aspect ratio. ``` ascii-image-converter [image paths/urls] -W # Or ascii-image-converter [image paths/urls] --width ``` Example: ``` ascii-image-converter [image paths/urls] -W 60 ``` #### --height OR -H > **Note:** Don't immediately append another flag with -H Set height of ascii art. Width is calculated according to aspect ratio. ``` ascii-image-converter [image paths/urls] -H # Or ascii-image-converter [image paths/urls] --height ``` Example: ``` ascii-image-converter [image paths/urls] -H 60 ``` #### --map OR -m > **Note:** Don't immediately append another flag with -m Pass a string of your own ascii characters to map against. Passed characters must start from darkest character and end with lightest. There is no limit to number of characters. Empty spaces can be passed if string is passed inside quotation marks. You can use both single or double quote for quotation marks. For repeating quotation mark inside string, append it with \ (such as \\"). ``` ascii-image-converter [image paths/urls] -m "" # Or ascii-image-converter [image paths/urls] --map "" ``` Following example contains 7 depths of lighting. ``` ascii-image-converter [image paths/urls] -m " .-=+#@" ```

#### --grayscale OR -g Display ascii art in grayscale colors. This is the same as --color flag, except each character will be encoded with a grayscale RGB value. ``` ascii-image-converter [image paths/urls] -g # Or ascii-image-converter [image paths/urls] --grayscale ``` #### --negative OR -n Display ascii art in negative colors. Works with both uncolored and colored text from --color flag. ``` ascii-image-converter [image paths/urls] -n # Or ascii-image-converter [image paths/urls] --negative ```

#### --complex OR -c Print the image with a wider array of ascii characters for more detailed lighting density. Sometimes improves accuracy. ``` ascii-image-converter [image paths/urls] -c # Or ascii-image-converter [image paths/urls] --complex ``` #### --full OR -f Print ascii art that fits the terminal width while maintaining aspect ratio. ``` ascii-image-converter [image paths/urls] -f # Or ascii-image-converter [image paths/urls] --full ``` #### --flipX OR -x Flip the ascii art horizontally on the terminal. ``` ascii-image-converter [image paths/urls] --flipX # Or ascii-image-converter [image paths/urls] -x ``` #### --flipY OR -y Flip the ascii art vertically on the terminal. ``` ascii-image-converter [image paths/urls] --flipY # Or ascii-image-converter [image paths/urls] -y ``` #### --save-img OR -s > **Note:** Don't immediately append another flag with -s Saves the ascii as a PNG image with the name `-ascii-art.png` in the directory path passed to the flag. Can work with both --color and --negative flag. Example for current directory: ``` ascii-image-converter [image paths/urls] --save-img . # Or ascii-image-converter [image paths/urls] -s . ``` #### --save-txt Similar to --save-img but it creates a TXT file with the name `-ascii-art.txt` in the directory path passed to the flag. Only saves uncolored text. Example for current directory: ``` ascii-image-converter [image paths/urls] --save-txt . ``` #### --save-gif > **Note:** This is an experimental feature and may not result in the finest quality GIFs, because all GIFs still aren't supported by ascii-image-converter. Saves the passed GIF as an ascii art GIF with the name `-ascii-art.gif` in the directory path passed to the flag.

#### --save-bg > **Note:** This flag will be ignored if `--save-img` or `--save-gif` flags are not set This flag takes an RGBA value that sets the background color in saved png and gif files. The fourth value (alpha value) is the measure of background opacity ranging between 0 and 100. ``` ascii-image-converter [image paths/urls] -s . --save-bg 255,255,255,100 # For white background ``` #### --font > **Note:** This flag will be ignored if `--save-img` or `--save-gif` flags are not set This flag takes path to a font .ttf file that will be used to set font in saved png or gif files. ``` ascii-image-converter [image paths/urls] -s . --font /path/to/font-file.ttf ``` #### --font-color This flag takes an RGB value that sets the font color in saved png and gif files as well as displayed ascii art in terminal. ``` ascii-image-converter [image paths/urls] -s . --font-color 0,0,0 # For black font color ``` #### --only-save Don't print ascii art on the terminal if some saving flag is passed. ``` ascii-image-converter [image paths/urls] -s . --only-save ``` #### --formats Display supported input formats. ``` ascii-image-converter --formats ```
## Library Usage > **Note:** The library may throw errors during Go tests due to some unresolved bugs with the [consolesize-go](https://github.com/nathan-fiscaletti/consolesize-go) package (Only during tests, not main program execution). First, install the library with: ``` go get -u github.com/TheZoraiz/ascii-image-converter/aic_package ``` For an image: ``` … ```
> **Note:** GIF conversion is not advised as the function may run infinitely, depending on the GIF. More work needs to be done on this to make it more library-compatible. For a GIF: ```go package main import ( "fmt" "github.com/TheZoraiz/asc

GitHub Issues· 22 开放

在 GitHub 查看全部
  • #62

    apt.fury.io 404 not found

    更新于 2026年5月15日
  • #61

    SPAM messages

    更新于 2026年5月4日
  • #52

    One color per character

    更新于 2025年9月4日
  • #40

    No option to save with color?

    更新于 2025年6月11日
  • #49

    `--negative` shouldn't invert alpha channels

    更新于 2025年1月5日
  • #36

    Can't convert: Unable to open file: img.png No such file or directory

    更新于 2024年11月27日
  • #44

    Feature Request: Canvas zoom

    更新于 2024年6月9日
  • #43

    Feature Request: Character Display Color

    更新于 2024年6月9日
  • #39

    Feature request to export colored ascii art directly to neofetch

    更新于 2023年10月7日
  • #37

    Phone portrait mode photos are rotated by 90°

    更新于 2023年5月22日

核心特点

  • •JPEG/JPG
  • •TIFF/TIF
  • •Installation
  • •Debian / Ubuntu-based
  • •Homebrew
  • •Linux (binaries)
  • •Windows (binaries)
  • •CLI Usage
  • •Library Usage
  • •Contributing

> 标签

Goasciiascii-artascii-imageascii-image-converter

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库