Closed heruan closed 4 years ago
It uses color distance to map from the origin colors to terminal colors. I'm currently working on support for 256 color imagery, which is supported by many terminals, but not all. Given the current state you can try
art.Image.distance = <your function>
On Fri, Jul 27, 2018 at 3:32 AM, Giovanni Lovato notifications@github.com wrote:
It is not clear how to use more colors when converting an image to ASCII art. For example, this:
$ ascii-art image file.png
and this:
var art = require('ascii-art'); var image = new art.Image({ filepath: 'file.png' });image.write(function(err, rendered){ console.log(rendered); })
produce ASCII art with few colors.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/khrome/ascii-art/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeLv9CnaQkNJp1SFZWcDv1cr1LWoQPiks5uKuxHgaJpZM4VjR7x .
Thank you for the response! There's no hurry, I'll try the 256 color support when it'll be ready 🙂
The rebuild of ascii-art is almost ready, but If you'd like to try 256 color support early, use ascii-art-image, ascii-art-ansi like so (I'm using ES5 syntax):
var Color = require('ascii-art-ansi/color');
var Image = require('ascii-art-image');
Color.is256 = true; //also supports .isTrueColor if your terminal does
Color.useDistance('closestByIntensity');
var image = new Image({
width : 80,
filepath : '/Your/File/Path/To/Image.type',
alphabet : 'blocks'
});
image.write(function(err, image){
//image is ready
})
Possible alphabets: variant1
, variant2
, variant3
, variant4
, ultra-wide
, wide
, hatching
, bits
, binary
, greyscale
, blocks
, solid
Color.useDistance(name);
values are : euclideanDistance
, classic
, ratioDistance
, classicByValue
, CIE76Difference
, closestByIntensity
, rankedChannel
, simple
, original
On release these options will be built into the call options rather than using the static defaults. Let me know if you encounter any issues.
Now documented and published.
It is not clear how to use more colors when converting an image to ASCII art. For example, this:
and this:
produce ASCII art with few colors.