Print Image to Terminal(iTerm2).
import { printImage } from "https://deno.land/x/imgcat/mod.ts";
await printImage(await Deno.readFile("./deno512.png"));
And run with deno run -A test.ts
.
Alo, You can use it with deno-canvas.
import { printImage } from "https://deno.land/x/imgcat/mod.ts";
import { createCanvas } from "https://deno.land/x/[email protected]/mod.ts";
const canvas = createCanvas(200, 200);
const ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(10, 10, 200 - 20, 200 - 20);
await printImage(canvas.toBuffer());