khrome / ascii-art

A Node.js library for ansi codes, figlet fonts, ascii art and other ASCII graphics
MIT License
681 stars 287 forks source link

Increase color depth? #31

Open scpedicini opened 1 year ago

scpedicini commented 1 year ago

Is there a functional difference between this lib and ascii-art-image?

I got ascii-art-image working, although the color palette is.... pretty bad on iTerm2 and I can't get it to display a better looking image unfortunately for a passed in RGB png file:

    var image = new Image({
        filepath: '/users/admin/images/candle.png',
        alphabet: 'blocks',
    });

    image.write(function(err, rendered){
        console.log(rendered);
    })

Original: image

Output: CleanShot 2023-05-22 at 16 23 10@2x

khrome commented 11 months ago

The color palette defaults to 4bit color (16 colors) you'll need to change your color depth to get more colors

If you want 256 coors:

var Color = require('ascii-art-ansi/colors');
Color.is256 = true;

If you want millions of colors:

var Color = require('ascii-art-ansi/colors');
Color.isTrueColor = true;