textifier 1.0.0

  • README.md
  • Installing
  • Versions
  • 42

Textifier is a dart library that lets you convert images to any text of your choosing, in your browser

OriginalColoredGrayscaleMonochromeConsole
OriginalColoredGrayscaleMonochromeConsole

Textifier can print as HTML an image or it can even print it in you browser's console.

Instalation

  $ pub get textifier

Usage

Here is the mandatory one-liner to show how simple it can be.

  new Textifier().draw('images/piggies.png', target);

Of course you are probably going to want use some options. Textifier takes a few optional named arguments.

⚠️ NOTES ⚠️

Textifier needs CORS access to the source images.

optional arguments

Every other option will be in the option object.

NamesDefaultsTypesInfo
maxWidthInfinityString|nummaxWidth should be a positive number. This sets maximum width of the rendered image. If it is not set or set with an invalid value, it will take as much space as it can.<br>Valid values are either a number or a valid CSS size value (e.g 200px).<br>Unless specified units will be measured in characters.
maxHeight"Infinity"String|numSame as maxWidth except that if it is not set the maximum height will be the the same as the height of the original image but in characters instead of pixels.
characters"01"StringThe character list to write the image with.
background#00000000StringColor of the background. This color will also be rendered in text.
orderedfalseboolIf true the characters will show up in order of the characters string
color0intIf the image should be colored, in grayscale or monochrome<br>0 = colored<br>1 = grayscale<br>2 = monochrome<br>Textifier comes with some constants so you don't have to memorize this

Functions

There are 3 main functions in Textifier, write, draw and log. There a few other mainly used internally but available anyways since they might come in handy.

write, draw

arguments: (String url, Element element, bool append)

The write and draw functions work exactly the same way. The only difference is that write will print html in a

 tag and the draw will print an actual image on a canvas.

url

type: String

The url of the image to be used.

element

type: Element

The element in which the rendered image will be added to.

append

type: bool

If the rendered image should be appended or replace the contents of the target element.

Example
  new Textifier(maxWidth: 100, characters: 'oink', ordered: true).draw('images/piggies.png', target);
Output

Rendered image

log

arguments: (String url)

The log function will print the image in the dev console of your browser.

url

type: String

The url of the image to be used.

Example
  new Textifier(maxWidth: 100, characters: 'oink', ordered: true).log('images/piggies.png');
Output

Rendered image

Constants

Textifier comes with some "constants" so you don't have to remember arguments that are numbers and to make your code more readable.

  Textifier.COLORED = 0;
  Textifier.GRAYSCALE = 1;
  Textifier.MONOCHROME = 2;

  Textifier.HTML = 0;
  Textifier.CANVAS = 1;
  Textifier.CONSOLE = 2;

License

MIT License

Use this package as a library

1. Depend on it

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


dependencies:
  textifier: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:textifier/textifier.dart';
  
Version Uploaded Documentation Archive
1.0.0 Dec 14, 2018 Go to the documentation of textifier 1.0.0 Download textifier 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
42
Learn more about scoring.

We analyzed this package on Jan 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.10

Platforms

Detected platforms: web

Primary library: package:textifier/textifier.dart with components: html, js.

Health issues and suggestions

Document public APIs. (-1 points)

32 out of 32 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Format lib/src/utils.dart.

Run dartfmt to format lib/src/utils.dart.

Format lib/textifier.dart.

Run dartfmt to format lib/textifier.dart.

Maintenance issues and suggestions

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use textifier.dart. Packages with multiple examples should use example/readme.md.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0