Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 1.06 KB

README.md

File metadata and controls

36 lines (25 loc) · 1.06 KB

Netpbm

Web viewer and converter for Netpbm files: .pbm, .pgm, .ppm (P1 - P6)

PPM Converter (Web)

import { PpmImage } from "@cs101/ppm-converter";

const imageConverter = new PpmImage(data); // data = byte string

imageConverter.getCanvas() // returns a canvas displaying the PPM file
imageConverter.getPNG()    // returns a b64 DataURI of a PNG

PPM Converter (NodeJS/Sharp)

import { PpmImage } from "@cs101/ppm-converter-sharp";

const imageConverter = new PpmImage(data); // data = Uint8Array

const image = imageConverter.getImage() // returns a sharp image

await image.toFile("image.png");

Credits:

Inspiration taken from: