Skip to main content
Deno 2 is finally here 🎉️
Learn more

pngs

Tags CI Status Dependencies License

A simple wasm png encoder/decoder module for deno using wasm.

Examples

Decoding

import { decode } from "https://deno.land/x/pngs/mod.ts";

const file = await Deno.readFile("image.png");
console.log(decode(file));

Encoding

import { encode } from "https://deno.land/x/pngs/mod.ts";

// An array containing a RGBA sequence where the first pixel is red and second is black
const data = new Uint8Array([255, 0, 0, 255, 0, 0, 0, 255]);
// Encode the image to have width 2 and height 1 pixel
const png = encode(data, 2, 1);

await Deno.writeFile("image.png", png);

Maintainers

Other

  • image-png - PNG decoding and encoding library in pure Rust

Contribution

Pull request, issues and feedback are very welcome. Code style is formatted with deno fmt and commit messages are done following Conventional Commits spec.

Licence

Copyright 2021, Denosaurs. All rights reserved. MIT license.