GithubHelp home page GithubHelp logo

hhh1994 / fast-png Goto Github PK

View Code? Open in Web Editor NEW

This project forked from image-js/fast-png

0.0 0.0 0.0 488 KB

PNG image decoder and encoder written entirely in JavaScript

License: MIT License

JavaScript 0.20% TypeScript 99.80%

fast-png's Introduction

fast-png

PNG image decoder and encoder written entirely in JavaScript.

Zakodium logo

Maintained by Zakodium

NPM version build status npm download

Installation

$ npm install --save fast-png

Usage

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

fast-png's People

Contributors

targos avatar cheminfo-bot avatar lpatiny avatar opatiny avatar p01 avatar rawnsley avatar sebastien-ahkrin avatar greenkeeperio-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.