Bitmap image formatting for CLI/Terminal
npm install @thi.ng/text-format-image
!npm downloads

> [!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
- Status
- Installation
- Dependencies
- API
- Authors
- License
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:
- https://iterm2.com/documentation-images.html
- https://github.com/BourgeoisBear/rasterm
- https://en.wikipedia.org/wiki/Sixel
(iTerm image strings are supported by at least: iterm2, mintty, mlterm, rio,
rlogin, wezterm...)
ALPHA - bleeding edge / work-in-progress
Search or submit any issues for this package
``bash`
yarn add @thi.ng/text-format-image
ESM import:
`ts`
import * as tfi from "@thi.ng/text-format-image";
Browser ESM import:
`html`
For Node.js REPL:
`js`
const tfi = await import("@thi.ng/text-format-image");
Package sizes (brotli'd, pre-treeshake): ESM: 334 bytes
`ts tangle:export/readme.ts
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" }));
`
If this project contributes to an academic publication, please cite it as:
`bibtex``
@misc{thing-text-format-image,
title = "@thi.ng/text-format-image",
author = "Karsten Schmidt",
note = "https://thi.ng/text-format-image",
year = 2025
}
© 2025 - 2026 Karsten Schmidt // Apache License 2.0