ascii-image-converter

repository·master·Indexed 25 days ago

https://github.com/thezoraiz/ascii-image-converter

A command-line tool and Go library that converts image formats (JPEG, PNG, BMP, WEBP, TIFF, GIF) into ASCII or braille art. It supports terminal output, saving to .png, .txt, and .gif files, and provides flags for controlling dimensions, color, grayscale, and custom character mapping.

Tokens
1.8K
Snippets
9
Records
21
Agent score
36%

What's inside ascii-image-converter

  1. Install ascii-image-converter on Debian or Ubuntu-based Distros

    master

    To install ascii-image-converter on Debian or Ubuntu-based systems using apt, add the repository and install the package using the following commands:

    1. Add the repository source.
    2. Update the package list.
    3. Install the converter.

    To remove the package source (disabling future updates), delete the list file in /etc/apt/sources.list.d/.

    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
  2. Install ascii-image-converter via AUR

    master

    For Arch Linux users, you can install the package from the AUR using standard makepkg or an AUR helper.

    # Standard way
    git clone https://aur.archlinux.org/ascii-image-converter-git.git
    cd ascii-image-converter-git/
    makepkg -si
    
    # Using an AUR helper
    <aur-helper> -S ascii-image-converter-git
  3. Use the aic_package Go library

    master

    Import github.com/TheZoraiz/ascii-image-converter/aic_package to convert images programmatically.

    Important: For environments without a terminal (like web servers), you MUST specify at least one of flags.Width, flags.Height, or flags.Dimensions.

    package main
    
    import (
    	"fmt"
    
    	"github.com/TheZoraiz/ascii-image-converter/aic_package"
    )
    
    func main() {
    	filePath := "myImage.jpeg"
    
    	flags := aic_package.DefaultFlags()
    
    	// Configuration
    	flags.Dimensions = []int{50, 25}
    	flags.Colored = true
    	flags.SaveTxtPath = "."
    	flags.SaveImagePath = "."
    	flags.CustomMap = " .-=+#@"
    	flags.FontFilePath = "./RobotoMono-Regular.ttf"
    	flags.SaveBackgroundColor = [4]int{50, 50, 50, 100}
    
    	// Conversion
    	asciiArt, err := aic_package.Convert(filePath, flags)
    	if err != nil {
    		fmt.Println(err)
    	}
    
    	fmt.Printf("%v\n", asciiArt)
    }