2.0.0 • Published 6 months ago

text2matrix v2.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

Text2Matrix

Introduction

Convert text strings into customizable pixel matrices with options for max height, letter spacing, and more. Ideal for LED displays and creative typographic applications.

Installation

npm install text2matrix

Usage

const { Font, Text } = require("text2matrix");

async function main() {
  const text = "Hello World!";
  const myFont = "myFont.ttf";
  const font = await Font.fromPath(myFont);
  const text = new Text(text, font, { fontSize: 16 });
  text.draw(); // only node environment, creates a png file
  const matrix = text.matrix; // returns a 2D array of grayscale values between 0 and 1
}