npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

braille-image

v1.0.1

Published

Convert images to Unicode braille text art

Downloads

291

Readme

braille-image

Convert images to Unicode braille text art.

Install

npm i braille-image

CLI

npx braille-image <input> [options]

| Option | Description | |--------|-------------| | -w, --width <cells> | Output width in braille cells (default: auto) | | --height <cells> | Output height in braille cells (default: auto) | | -t, --threshold <n> | Brightness threshold 0–255 (default: 128) | | -i, --invert | Invert luminance before thresholding | | -h, --help | Show usage |

Examples:

# Auto-sized output
npx braille-image photo.jpg

# Fixed 40-cell wide output
npx braille-image photo.jpg --width 40

# Inverted with custom threshold
npx braille-image photo.jpg --invert --threshold 200

Library API

import { imageToBraille } from 'braille-image';

const art = await imageToBraille('./photo.jpg', {
  width: 40,
  invert: true,
});

console.log(art);

imageToBraille(input, options?)

| Param | Type | Description | |-------|------|-------------| | input | string \| Buffer \| Uint8Array | File path or image buffer | | options.threshold | number (0–255) | Brightness cutoff. Default: 128 | | options.width | number | Target width in braille cells | | options.height | number | Target height in braille cells | | options.invert | boolean | Invert luminance. Default: false |

Returns: Promise<string> — braille text with \n-separated rows.

Throws: TypeError on invalid options, Error on image processing failures.

How it works

  1. Grayscale — the input image is converted to single-channel luminance via sharp.

  2. Resize — if width / height are specified, the image is scaled to (width × 2) × (height × 4) pixels so each braille cell maps to exactly one 4×2 pixel block.

  3. Threshold — each pixel is compared against the threshold value. Brighter pixels are "raised dots"; darker pixels are left empty.

  4. Braille encoding — every 4×2 block is packed into one Unicode braille character using the standard dot layout:

    Physical      Bit
     1 .  4      0 .  3
     2 .  5      1 .  4
     3 .  6      2 .  5
     7 .  8      6 .  7

Development

This project was built collaboratively with Reasonix Code.

Quick start

git clone https://github.com/PuppyOne/braille-image.git
cd braille-image
npm i
npm run build
npm test

Stack

| Layer | Tool | |-------|------| | Runtime | Node.js ≥ 18, ESM | | Image processing | sharp | | Build | tsdown | | Test | vitest | | Language | TypeScript 6 |

License

Apache-2.0