Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Repository files navigation

A Dart-based ASCII art converter that transforms images into ASCII art. Available as a reusable library and command-line tool.

✨ Features

  • 🖼️ 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

example

📖 How it works

Check out thethe algorithm for details on how each pixel is processed and mapped to ASCII characters.

🚀 Installation

As a Library

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

As a CLI Tool

Activate it globally:

dart pub global activate ascii_art_converter

🛠️ Usage

Library Example

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);}

CLI Example

# 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

⚙️ CLI Options

OptionDescriptionDefault
-i, --inputInput image file pathrequired
-o, --outputOutput file path (optional, prints to stdout)stdout
-w, --widthOutput width (in characters)80
-s, --charsetCharacter set (preset name or custom string)standard
-c, --colorOutput color mode: grayscale, ansi256, trueColorgrayscale
-a, --aspect-ratioCharacter aspect ratio (font width/height ratio)0.5
--[no-]invertInvert brightness mapping (dark ↔ light)true
-v, --verbosePrint details during executionfalse
-h, --helpShow 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

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp