New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cwasm/lodepng

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cwasm/lodepng

PNG decoding/encoding for Node.js, using [LodePNG][LodePNG] compiled to [WebAssembly][WebAssembly].

0.1.7
latest
Source
npm
Version published
Weekly downloads
3.4K
-10.24%
Maintainers
1
Weekly downloads
 
Created
Source

LodePNG

PNG decoding/encoding for Node.js, using LodePNG compiled to WebAssembly.

Installation

npm install --save @cwasm/lodepng

Usage

const fs = require('fs')
const lodepng = require('@cwasm/lodepng')

const source = fs.readFileSync('image.png')
const image = lodepng.decode(source)

console.log(image)
// { width: 128,
//   height: 128,
//   data:
//    Uint8ClampedArray [ ... ] }

const data = lodepng.encode(image)

console.log(data)
// Uint8Array [ 137, 80, 78, 71, ... ]

API

decode(source)

  • source (Uint8Array, required) - The PNG data
  • returns ImageData - Decoded width, height and pixel data

encode(source)

  • source (ImageLike, required) - The image data
  • returns Uint8Array - Encoded data

FAQs

Package last updated on 26 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts