enough_ascii_art 0.9.7

  • Readme
  • Changelog
  • Example
  • Installing
  • 68

An ASCII art library for Dart developers.

Available under the commercial friendly MPL Mozilla License 2.0.

Usage #

Things you can do with enough_ascii_art:

  • Generate a textual representation of an image using convertImage(..).
  • Convert common UTF-8 emoticons to their text-representation with convertEmoticons(..).
  • Create FIGlet text banners with renderFiglet(..).

Usage example:

import 'dart:io';
import 'package:enough_ascii_art/enough_ascii_art.dart';
import 'package:image/image.dart' as img;

void main() async {
  var image = img.decodeImage(File('./example/enough.jpg').readAsBytesSync());
  var asciiImage = convertImage(image, maxWidth: 40, invert: true);
  print('');
  print(asciiImage);
  var helloWithUtf8Smileys = 'hello world 😛';
  var helloWithTextSmileys =
      convertEmoticons(helloWithUtf8Smileys, EmoticonStyle.western);
  print('');
  print(helloWithTextSmileys);
  print('');
  print('cosmic:');
  var figure = await renderFigletWithFontName('ENOUGH', 'cosmic');
  print(figure);
  print('');
  print('shadow:');
  figure = await renderFigletWithFontName('ENOUGH', 'shadow');
  print(figure);
  print('');
  print('smslant:');
  figure = await renderFigletWithFontName('ENOUGH', 'smslant');
  print(figure);
  print('');
  print('eftifont:');
  figure = await renderFigletWithFontName('ENOUGH', 'eftifont');
  print(figure);
  print('');
  print('big:');
  figure = await renderFigletWithFontName('ENOUGH', 'big');
  print(figure);
  print('');
  print('isometric1:');
  figure = await renderFigletWithFontName('ENOUGH', 'isometric1');
  print(figure);
  print('');
  print('chunky:');
  figure = await renderFigletWithFontName('ENOUGH', 'chunky');
  print(figure);
  print('');
}

The above code renders the following output:

%%%%%%%%%%%%%%%%%%@%@%#%#%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%##      -@%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%.        .#%%%%%%%%%%%
%%%%%%%%%%%%%%%%%#          #%%%%%%%%%%%
%%%%%%%%%%%%%%%%#@           %%%%%%%%%%%
%%%%%%%%%%%%% #*  #      @   %%%%%%%%%%%
%%%%%%%%%%%%%%-    *   =%    #%%%%%%%%%%
%%%%%%%%%%%%%%@#      *%     .#%%%%%%%%%
%%%%%%%%%%%%%%%%-    .@%%       %%%%%%%%
%%%%%%%%%%%%%%%=    @%%@          #%%%%%
%%%%%%%%%%%%%%#     #%%=            ##%%
%%%%%%%%%%%%%%%.      .               #%
%%%%%%%%%%%%%%%%@                      *
%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%                 #
%%%%%%%%%%%%%%%%%%%%%%-              +%%
%%%%%%%%%%%%%%%%%%%%%%%.             %%%
%%%%%%%%%%%%%%%%%%%%%%%.           :%%%%
%%%%%%%%%%%%%%%%%%%%%%.             +@%%
%%%%%%%%%%%%%%%%%%%%%%    +%%%%%@    @%%
%%%%%%%%%%%%%%%%%%%%%.    @%%%%%#     %%
%%%%%%%%%%%%%%%%%%%%%     #%%%%%@     %%
%%%%%%%%%%%%%%%%%%%%%%-  -%%%%%%      %%


hello world :-P

cosmic:
.,:::::::::.    :::.    ...      ...    :::  .,-:::::/    ::   .:
;;;;''''`;;;;,  `;;; .;;;;;;;.   ;;     ;;;,;;-'````'    ,;;   ;;,
 [[cccc   [[[[[. '[[,[[     \[[,[['     [[[[[[   [[[[[[/,[[[,,,[[[
 $$""""   $$$ "Y$c$$$$$,     $$$$$      $$$"$$c.    "$$ "$$$"""$$$
 888oo,__ 888    Y88"888,_ _,88P88    .d888 `Y8bo,,,o88o 888   "88o
 """"YUMMMMMM     YM  "YMMMMMP"  "YmmMMMM""   `'YMUP"YMM MMM    YMM


shadow:
 ____|  \  |  _ \  |   |  ___| |   |
 __|     \ | |   | |   | |     |   |
 |     |\  | |   | |   | |   | ___ |
_____|_| \_|\___/ \___/ \____|_|  _|



smslant:
   _____  ______  __  _________ __
  / __/ |/ / __ \/ / / / ___/ // /
 / _//    / /_/ / /_/ / (_ / _  /
/___/_/|_/\____/\____/\___/_//_/



eftifont:
 ___  _  _  _  _ _  __  _ _
| __|| \| |/ \| | |/ _|| U |
| _| | \\ ( o ) U ( |_n|   |
|___||_|\_|\_/|___|\__/|_n_|



big:
 ______ _   _  ____  _    _  _____ _    _
|  ____| \ | |/ __ \| |  | |/ ____| |  | |
| |__  |  \| | |  | | |  | | |  __| |__| |
|  __| | . ` | |  | | |  | | | |_ |  __  |
| |____| |\  | |__| | |__| | |__| | |  | |
|______|_| \_|\____/ \____/ \_____|_|  |_|




isometric1:
      ___           ___           ___           ___           ___           ___
     /\  \         /\__\         /\  \         /\__\         /\  \         /\__\
    /::\  \       /::|  |       /::\  \       /:/  /        /::\  \       /:/  /
   /:/\:\  \     /:|:|  |      /:/\:\  \     /:/  /        /:/\:\  \     /:/__/
  /::\~\:\  \   /:/|:|  |__   /:/  \:\  \   /:/  /  ___   /:/  \:\  \   /::\  \ ___
 /:/\:\ \:\__\ /:/ |:| /\__\ /:/__/ \:\__\ /:/__/  /\__\ /:/__/_\:\__\ /:/\:\  /\__\
 \:\~\:\ \/__/ \/__|:|/:/  / \:\  \ /:/  / \:\  \ /:/  / \:\  /\ \/__/ \/__\:\/:/  /
  \:\ \:\__\       |:/:/  /   \:\  /:/  /   \:\  /:/  /   \:\ \:\__\        \::/  /
   \:\ \/__/       |::/  /     \:\/:/  /     \:\/:/  /     \:\/:/  /        /:/  /
    \:\__\         /:/  /       \::/  /       \::/  /       \::/  /        /:/  /
     \/__/         \/__/         \/__/         \/__/         \/__/         \/__/


chunky:
 _______ _______ _______ _______ _______ _______
|    ___|    |  |       |   |   |     __|   |   |
|    ___|       |   -   |   |   |    |  |       |
|_______|__|____|_______|_______|_______|___|___|

Installation #

Add this dependency your pubspec.yaml file:

dependencies:
  enough_ascii_art: ^0.8.0

The latest version or enough_ascii_art is enough_ascii_art version.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Run Example #

After checking out this project, you can run the example from the root with this command:

dart ./example/enough_ascii_art_example.dart

Contribute & Known Limitations #

Any contributions are welcome!

Known limitations:

  • Images are always converted to grayscale
  • The FIGlet banners are currently only supported with left-to-right text direction
  • The FIGlet banners are not wrapped into multiple lines
  • You cannot list all available FIGlet fonts, but instead need to know their names (check out the lib/src/figlet/fonts directory!)
  • Currently only western style text emoticons are available

Please help removing these limitations!

0.9.7 #

  • Fixed file path addressing on Windows

0.9.6 #

  • Fixing resource loading of fonts (different approach based on File)

0.9.5 #

  • Fixing resource loading of fonts (more debug output)

0.9.4 #

  • Fixing resource loading of fonts (more debug output)

0.9.3 #

  • Fixing resource loading of fonts (more debug output)

0.9.2 #

  • Fixing resource loading of fonts (more debug output)

0.9.1 #

  • Fixing resource loading of fonts (first try)

0.9.0 #

  • Supports FIGlet text banners

0.8.0 #

  • Initial version, providing support for image to ASCII and smiley to ASCII transformation

example/enough_ascii_art_example.dart

import 'dart:io';
import 'package:enough_ascii_art/enough_ascii_art.dart';
import 'package:image/image.dart' as img;

void main() async {
  var image = img.decodeImage(File('./example/enough.jpg').readAsBytesSync());
  var asciiImage = convertImage(image, maxWidth: 40, invert: true);
  print('');
  print(asciiImage);
  var helloWithUtf8Smileys = 'hello world 😛';
  var helloWithTextSmileys =
      convertEmoticons(helloWithUtf8Smileys, EmoticonStyle.western);
  print('');
  print(helloWithTextSmileys);
  print('');
  print('cosmic:');
  var figure = await renderFigletWithFontName('ENOUGH', 'cosmic');
  print(figure);
  print('');
  print('shadow:');
  figure = await renderFigletWithFontName('ENOUGH', 'shadow');
  print(figure);
  print('');
  print('smslant:');
  figure = await renderFigletWithFontName('ENOUGH', 'smslant');
  print(figure);
  print('');
  print('eftifont:');
  figure = await renderFigletWithFontName('ENOUGH', 'eftifont');
  print(figure);
  print('');
  print('big:');
  figure = await renderFigletWithFontName('ENOUGH', 'big');
  print(figure);
  print('');
  print('isometric1:');
  figure = await renderFigletWithFontName('ENOUGH', 'isometric1');
  print(figure);
  print('');
  print('chunky:');
  figure = await renderFigletWithFontName('ENOUGH', 'chunky');
  print(figure);
  print('');
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  enough_ascii_art: ^0.9.7

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:enough_ascii_art/enough_ascii_art.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
38
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15

Analysis suggestions

Package not compatible with runtime flutter-web on Web

Because:

  • package:enough_ascii_art/enough_ascii_art.dart that imports:
  • package:enough_ascii_art/src/figlet/figlet.dart that imports:
  • package:resource/resource.dart that imports:
  • package:resource/src/resource_loader.dart that imports:
  • package:resource/src/package_loader.dart that imports:
  • package:resource/src/resolve.dart that imports:
  • dart:isolate

Package not compatible with runtime js

Because:

  • package:enough_ascii_art/enough_ascii_art.dart that imports:
  • package:enough_ascii_art/src/figlet/figlet.dart that imports:
  • package:resource/resource.dart that imports:
  • package:resource/src/resource_loader.dart that imports:
  • package:resource/src/package_loader.dart that imports:
  • package:resource/src/resolve.dart that imports:
  • dart:isolate

Health suggestions

Fix lib/src/figlet/figlet.dart. (-1.49 points)

Analysis of lib/src/figlet/figlet.dart reported 3 hints:

line 2 col 8: Unused import: 'dart:isolate'.

line 4 col 1: 'package:resource/resource.dart' is deprecated and shouldn't be used. This package has been discontinued. See library documentation of README.md for more infomration.

line 4 col 8: Unused import: 'package:resource/resource.dart'.

Fix lib/src/figlet/font.dart. (-0.50 points)

Analysis of lib/src/figlet/font.dart reported 1 hint:

line 1 col 8: Unused import: 'package:enough_ascii_art/enough_ascii_art.dart'.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
image ^2.1.12 2.1.14
isolate ^2.0.3 2.0.3
resource ^2.1.6 2.1.7
Transitive dependencies
archive 2.0.13
args 1.6.0
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
crypto 2.1.5
meta 1.2.2 1.3.0-nullsafety
path 1.7.0
petitparser 3.0.4
typed_data 1.2.0 1.3.0-nullsafety
xml 4.2.0
Dev dependencies
pedantic ^1.8.0
test ^1.6.0