Sign inSign up

defnotgustavom/ascii-image-converter

By defnotgustavom

•Updated over 3 years ago

CLI Image/GIF to ascii converter.

Image
0

5.9K

defnotgustavom/ascii-image-converter repository overview

  • Running:

docker run -it --rm --log-driver none --net none --read-only defnotgustavom/ascii-image-converter /ascii-image-converter (image link or image file) (flags)

  • 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

Tag summary

Content type

Image

Digest

sha256:18a9bf34c…

Size

4 MB

Last updated

over 3 years ago

docker pull defnotgustavom/ascii-image-converter