Skip to content

Apollo478/ascii-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT

🎥 ASCII Converter

Convert images, GIFs,audio, videos and webcam steam into ASCII art in the terminal or save them as files.

ASCII Converter is a tool that can be used to convert or preview images (png, jpg), GIFs, videos (mp4, avi, mov, webm), audio (mp3, wav) and webcam streams in ASCII art mode.

⚠️ Video, audio and webcam support requires FFmpeg to be installed.
📷 Camera conversion is currently available only on Linux.

Installation

go install github.com/Apollo478/ascii-converter@latest

GIF/Image to ASCII Comparison

Here’s a side-by-side look at the conversion:

Original ASCII (no color) ASCII (colored)
Original ASCII BW ASCII Color
Original ASCII BW ASCII Color
Original ASCII BW ASCII Color
Original ASCII BW ASCII Color

📖 Usage

Usage: ac <command> [options]

Commands:
  convert   Convert image/gif/video to ASCII
  preview   Preview ASCII frames in terminal
  camera    Preview/convert camera ASCII frames
  audio   Visualize audio in ascii art 

convert

ac convert -i <input> -o <output> [options]

# Options
Usage of convert:
  -C    Alias for --color
  -I    Alias for --invert
  -P    Alias for --preview
  -a float
        Alias for --aspect-ratio (default 0.5)
  -aspect-ratio float
        Set aspect ratio of ASCII’s Y axis (default 0.5)
  -clear-screen
        Clear screen before printing frames (default true)
  -color
        Enable colored ASCII
  -f    Alias for --fit-terminal
  -fit-terminal
        Fit ASCII to terminal size
  -h int
        Alias for --height (default 120)
  -height int
        ASCII height (default 120)
  -i string
        Alias for --input
  -input string
        Input file
  -invert
        Invert the ASCII scale
  -o string
        Alias for --output
  -output string
        output file
  -p    Alias for --parallel
  -parallel
        Process frames in parallel
  -preview
        Preview ascii while saving
  -s    Alias for --clear-screen (default true)
  -w int
        Alias for --width (default 140)
  -width int
        ASCII width (default 140)

preview

ac preview -i <input> [options]

#Options
Usage of preview:
  -C    Alias for --color
  -I    Alias for --invert
  -a float
        Alias for --aspect-ratio (default 0.5)
  -aspect-ratio float
        Set aspect ratio of ASCII’s Y axis (default 0.5)
  -clear-screen
        Clear screen before printing frames (default true)
  -color
        Enable colored ASCII
  -f    Alias for --fit-terminal
  -fit-terminal
        Fit ASCII to terminal size
  -h int
        Alias for --height (default 120)
  -height int
        ASCII height (default 120)
  -i string
        Alias for --input
  -plain
    	Output the ASCII art as simple line-by-line text with ANSI color codes, without using cursor repositioning or screen clearing escape sequences.(image only)
  -input string
        Input file
  -invert
        Invert the ASCII scale
  -p    Alias for --parallel
  -parallel
        Process frames in parallel
  -s    Alias for --clear-screen (default true)
  -w int
        Alias for --width (default 140)
  -width int
        ASCII width (default 140)

camera

ac camera  [options]

# Options
Usage of camera:
  -C    Alias for --color
  -I    Alias for --invert
  -P    Alias for --preview
  -a float
        Alias for --aspect-ratio (default 0.5)
  -aspect-ratio float
        Set aspect ratio of ASCII’s Y axis (default 0.5)
  -clear-screen
        Clear screen before printing frames (default true)
  -color
        Enable colored ASCII
  -f    Alias for --fit-terminal
  -fit-terminal
        Fit ASCII to terminal size
  -h int
        Alias for --height (default 120)
  -height int
        ASCII height (default 120)
  -invert
        Invert the ASCII scale
  -o string
        Alias for --output
  -output string
        output file
  -p    Alias for --parallel
  -parallel
        Process frames in parallel
  -preview
        Preview ascii while saving
  -s    Alias for --clear-screen (default true)
  -w int
        Alias for --width (default 140)
  -width int
        ASCII width (default 140)

audio

ac audio -i <input> [options]

#Options
-2D
        2 dimentional audio visualization
  -C    Alias for --color
  -I    Alias for --invert
  -a float
        Alias for --aspect-ratio (default 0.5)
  -aspect-ratio float
        Set aspect ratio of ASCII’s Y axis (default 0.5)
  -clear-screen
        Clear screen before printing frames (default true)
  -color
        Enable colored ASCII
  -f    Alias for --fit-terminal (default true)
  -fit-terminal
        Fit ASCII to terminal size (default true)
  -fr
        Aliad for --full-ramp
  -full-ramp
        Use a wider set of characters
  -h int
        Alias for --height (default 120)
  -height int
        ASCII height (default 120)
  -i string
        Alias for --input
  -input string
        Input file
  -invert
        Invert the ASCII scale
  -s    Alias for --clear-screen (default true)
  -w int
        Alias for --width (default 140)
  -wave
        Audio to wave visualization
  -width int
        ASCII width (default 140)

🎥 CLI Demo

Here’s a quick demo of the CLI converting a video into ASCII art:

CLI Demo

In this example, the tool takes a video input and outputs an ASCII-rendered version in real time.

Try it yourself

ac preview -i examples/andvari.mp4 -C

Audio visualization

Check out the audio source video

Audio visualization