@jdmichaud/netpbm

0.2.1 • Public • Published

netpbm.js

A no-dependency library to parse Netpbm (and Netpgm and Netppm) files in javascript.

⚠️ Only manages ASCII format for now.

Usage

Use the decode function who's signature is...:

function decode(data: Uint8Array): ImageData;

... this way:

const content = fs.readFileSync(content).buffer;
const imageData = decode(content);

Or the fromString function who's signature is...:

function fromString(content: string): ImageData;

... this way:

const J = `P1
# This is an example bitmap of the letter "J"
6 10
000010000010000010000010000010000010100010011100000000000000`;
const imageData = fromtString(J);

Test

Execute:

npm test

and open your browser to:

http://localhost:10001

In the console, all tests should be passed.

Readme

Keywords

Package Sidebar

Install

npm i @jdmichaud/netpbm

Weekly Downloads

78

Version

0.2.1

License

MIT

Unpacked Size

27.5 kB

Total Files

8

Last publish

Collaborators

  • jdmichaud