JSPM

  • Created
  • Published
  • Downloads 1150
  • Score
    100M100P100Q93833F
  • License MIT

Unofficial bindings for node to libpng.

Package Exports

  • node-libpng

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-libpng) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-libpng

npm Build Status Build status Coverage Status

Unofficial bindings for node to libpng.

Please also refer to the Documentation.

Table of contents

Supported environments

This is a native Addon to NodeJS which delivers prebuilt binaries. Only some environments are supported:

Node Version Windows 64-Bit Windows 32-Bit Linux 64-Bit Linux 32-Bit OSX
Earlier - - - - -
Node 6 (Abi 48) ✔️ ✔️ ✔️ - ✔️
Node 7 (Abi 51) ✔️ ✔️ ✔️ - ✔️
Node 8 (Abi 57) ✔️ ✔️ ✔️ - ✔️
Node 9 (Abi 59) ✔️ ✔️ ✔️ - ✔️

Benchmark

As it is a native addon, node-libpng is much faster than libraries like pngjs:

Read access (Decoding)

The chart below shows the comparison of decoding an image between pngjs (sync api) and node-libpng. The time to fully decode a 4096x4096 image is measured (Higher is better).

read benchmark

(The x-axis scale shows the amount of fully decoded images per second.)

Write access (Encoding)

The chart below shows the comparison of encoding an image between pngjs (sync api) and node-libpng. The time to fully encode a 4096x4096 image is measured (Higher is better).

access benchmark

(The x-axis scale shows the amount of fully encoded images per second.)

Pixel Access

The chart below shows the comparison of accessing all pixels in a decoded image between pngjs and node-libpng. The time to fully access every pixel in the raw data is measured (Higher is better).

access benchmark

(The x-axis scale shows the amount of fully accessed images per second.)

Contributing

Yarn is used instead of npm, so make sure it is installed, probably: npm install -g yarn.

Install all dependencies using

yarn install

Building

In order to build the code:

yarn build

Running the tests with coverage

yarn test

Linting

yarn lint

Starting the example

Server:

cd exmaple
yarn run:server

Client:

cd exmaple
yarn run:client

Generating the libpng config

Libpng requires an OS specific configuration headerfile pnglibconf.h. This can be generated by executing:

git submodule update --init --recursive
cd deps/libpng
mkdir build
cd build
cmake ..
make
cp pnglibconf.h ../../config/linux/

Contributors

  • Frederick Gnodtke