fast-png
PNG image decoder and encoder written entirely in JavaScript
Last updated 8 months ago by cheminfo-bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fast-png 
SYNC missed versions from official npm registry.

Zakodium logo

Maintained by Zakodium

fast-png

NPM version npm download test coverage license

PNG image decoder and encoder written entirely in JavaScript.

Installation

npm install fast-png

API

Complete API documentation

decode(png[, options])

Arguments

  • png - A TypedArray or Buffer that contains the PNG data.
  • options - An object of options

Options

  • checkCrc - If set to true, the CRC will be checked for each chunk and an error will be thrown in case it's wrong (default: false).

encode(image)

Arguments

  • png - An object representing the image. You can pass an ImageData from the Canvas API or an object with the following properties:
    • width - The width of the image
    • height - The height of the image
    • data - An array or TypedArray with the image data
    • depth - A number indicating the color depth (only 8 and 16 are supported now). Default: 8.
    • channels - Number of channels, including alpha (1, 2, 3 and 4 are supported). Default: 4.
    • text - An object with key-value pairs representing tEXt chunks. The keys must have less than 80 characters. The keys and values must have only characters in the latin1 charset (maximum code point of 255). Default: undefined.

hasPngSignature(array)

Returns whether the array starts with the PNG signature (magic bytes).

PNG standard

Spec can be found at: https://www.w3.org/TR/PNG/

License

MIT

Current Tags

  • 7.0.1                                ...           latest (8 months ago)

28 Versions

  • 7.0.1                                ...           8 months ago
  • 7.0.0                                ...           10 months ago
  • 6.4.0                                ...           10 months ago
  • 6.3.0                                ...           a year ago
  • 6.2.0                                ...           3 years ago
  • 6.1.0                                ...           4 years ago
  • 6.0.1                                ...           4 years ago
  • 6.0.0                                ...           5 years ago
  • 5.0.4                                ...           5 years ago
  • 5.0.3                                ...           5 years ago
  • 5.0.2                                ...           6 years ago
  • 5.0.1                                ...           6 years ago
  • 5.0.0                                ...           6 years ago
  • 4.0.1                                ...           7 years ago
  • 4.0.0                                ...           7 years ago
  • 3.1.3                                ...           7 years ago
  • 3.1.2                                ...           7 years ago
  • 3.1.1                                ...           7 years ago
  • 3.1.0                                ...           9 years ago
  • 3.0.0                                ...           9 years ago
  • 2.0.1                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 1.1.0                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 0.0.4                                ...           11 years ago
  • 0.0.3                                ...           11 years ago
  • 0.0.2                                ...           11 years ago
  • 0.0.1                                ...           11 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (3)
Dev Dependencies (10)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |