Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@thi.ng/text-format-image

npm version npm downloads Mastodon Follow

Note

This is one of 214 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.

🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️

About

Bitmap image formatting for CLI/Terminal.

Currently only supports the widely supported iTerm format as output format. Sixel support considered. Accepts images in various file formats (e.g. JPG, PNG etc.) or thi.ng/pixel pixel buffers.

Reference:

(iTerm image strings are supported by at least: iterm2, mintty, mlterm, rio, rlogin, wezterm...)

Status

ALPHA - bleeding edge / work-in-progress

Search or submit any issues for this package

Installation

yarn add @thi.ng/text-format-image

ESM import:

import * as tfi from "@thi.ng/text-format-image";

Browser ESM import:

<script type="module" src="https://esm.run/@thi.ng/text-format-image"></script>

JSDelivr documentation

For Node.js REPL:

const tfi = await import("@thi.ng/text-format-image");

Package sizes (brotli'd, pre-treeshake): ESM: 334 bytes

Dependencies

API

Generated API docs

import { iTermImageStringFromBinary } from "@thi.ng/text-format-image";
import { readFileSync } from "node:fs";

// read JPG as binary blob
const src = readFileSync("assets/examples/zig-cellular.jpg");

// convert to image string to show image at 200px width
// (example will only work in terminals supporting the iTerm image format)
console.log(iTermImageStringFromBinary(src, { width: "400px" }));

Authors

If this project contributes to an academic publication, please cite it as:

@misc{thing-text-format-image,
  title = "@thi.ng/text-format-image",
  author = "Karsten Schmidt",
  note = "https://thi.ng/text-format-image",
  year = 2025
}

License

© 2025 - 2026 Karsten Schmidt // Apache License 2.0