@thi.ng/text-format-image
v0.1.2
Published
Bitmap image formatting for CLI/Terminal
Maintainers
Readme
[!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:
- 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...)
Status
ALPHA - bleeding edge / work-in-progress
Search or submit any issues for this package
Installation
yarn add @thi.ng/text-format-imageESM 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>For Node.js REPL:
const tfi = await import("@thi.ng/text-format-image");Package sizes (brotli'd, pre-treeshake): ESM: 334 bytes
Dependencies
API
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
