A simple wasm png encoder/decoder module for deno using wasm.
import { decode } from "https://deno.land/x/pngs/mod.ts";
const file = await Deno.readFile("image.png");
console.log(decode(file));
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);
- Elias Sjögreen (@eliassjogreen)
- image-png - PNG decoding and encoding library in pure Rust
Pull request, issues and feedback are very welcome. Code style is formatted with
deno fmt
and commit messages are done following
Conventional Commits spec.
Copyright 2021, Denosaurs. All rights reserved. MIT license.