- Notifications
You must be signed in to change notification settings - Fork1
A Dart-based ASCII art converter that transforms images into ASCII art. Available as a reusable library and command-line tool.
License
NotificationsYou must be signed in to change notification settings
Gj1337/ascii_art_converter
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A Dart-based ASCII art converter that transforms images into ASCII art. Available as a reusable library and command-line tool.
- 🖼️ Convert images to ASCII art
- ⚙️ Customizable output width and character sets
- 🎨 Multiple color modes: grayscale, ANSI 256, true color
- 📦 Available as both library and CLI tool
- ⚡ Fast and lightweight Dart implementation
Check out thethe algorithm for details on how each pixel is processed and mapped to ASCII characters.
Add the package to yourpubspec.yaml:
dependencies:ascii_art_converter:^1.1.0
or add the library by command:
flutter pub add ascii_art_converter
Activate it globally:
dart pub global activate ascii_art_converter
import'dart:io';import'package:ascii_art_converter/ascii_art_converter.dart';voidmain()async {final bytes=awaitFile('example.png').readAsBytes();final ascii=awaitAsciiConverter().convert( bytes, width:100, charset:CharSet.standart, invert:true, colorMode:ColorMode.ansi256, );print(ascii);}
# Convert an image and print to terminalascii_art -i cat.png# Save ASCII art to a fileascii_art -i cat.png -o cat.txt# Use custom widthascii_art -i cat.png -w 120# Apply a different character setascii_art -i cat.png -s blocksascii_art -i cat.png -s"@#*+=-:."# Custom charset string# Invert brightness mappingascii_art -i cat.png --no-invert# Enable ANSI 256-color modeascii_art -i cat.png --color ansi256# Enable true color (24-bit RGB) modeascii_art -i cat.png --color trueColor# Adjust character aspect ratio (for fonts with different proportions)ascii_art -i cat.png -a 0.6# Show helpascii_art --help
| Option | Description | Default |
|---|---|---|
-i, --input | Input image file path | required |
-o, --output | Output file path (optional, prints to stdout) | stdout |
-w, --width | Output width (in characters) | 80 |
-s, --charset | Character set (preset name or custom string) | standard |
-c, --color | Output color mode: grayscale, ansi256, trueColor | grayscale |
-a, --aspect-ratio | Character aspect ratio (font width/height ratio) | 0.5 |
--[no-]invert | Invert brightness mapping (dark ↔ light) | true |
-v, --verbose | Print details during execution | false |
-h, --help | Show help message |
About
A Dart-based ASCII art converter that transforms images into ASCII art. Available as a reusable library and command-line tool.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
