DEV Community

Cover image for Day 23: Terminal Images šŸ–¼ļø
Valeria
Valeria

Posted on

Day 23: Terminal Images šŸ–¼ļø

Did you know that you could draw anything in a terminal?
Sure the quality would vary from one to another, but in general terminal-image works in any terminal with a colour.

It's pretty easy to use too!

Install it with your favourite package manager, e.g. deno add npm:terminal-image and create a script, e.g. main.ts:

import terminalImage from 'terminal-image';

console.log(await terminalImage.file('image.png'));
Enter fullscreen mode Exit fullscreen mode

Drop a file image.png in the same folder as script (or a .jpg if you'd like, just don't forget to change the name like I do sometimes).

Run it with e.g. deno run -A main.ts and enjoy:

ValeriaVG Logo in terminal

It looks even better in iTerm:

Clear image

Wanna know how they did it? Yup, ansi-escapes once again!

Liked the content and would love to have more of it all year long?

Buy Me A Coffee

Top comments (0)