GithubHelp home page GithubHelp logo

meta-png's Introduction

meta-png

NPM version codecov Test Lint

Simple, zero-dependencies NodeJS/JavaScript library to store and retrieve metadata in PNG files.

Installation

Use your favourite package manager

npm install meta-png
# or: yarn add meta-png

Usage

The library provides two functions to add a new metadata:

addMetadata(PNGUint8Array, key, value)  // stores the given key-value inside the PNG, provided as Uint8Array
addMetadataFromBase64DataURI(dataURI, key, value)  // stores the given key-value inside the PNG, provided as a Data URL string

and a function to get back the stored value:

getMetadata(PNGUint8Array, key)  // retrives the given key from a PNG provided as Uint8Array

Limitations

  • tEXt chunks inside PNG files are meant to use the Latin-1 standard: using characters outside this charset may lead to unwanted behaviors
  • No check is performed inside add functions to test whether a given key is already present in the file. If you need it, you can call getMetadata beforehand and assert that it gives back undefined.

meta-png's People

Contributors

frsgit avatar lucach avatar pkrasinski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pkrasinski frsgit

meta-png's Issues

CRC checksum is wrong after adding metadata

Hi, I saw the following error from Imagemagick on an image I had modified identify -verbose updated.png:

identify: tEXt: CRC error `updated.png' @ warning/png.c/MagickPNGWarningHandler/1669.

Does the CRC checksum need to be updated after modifying the tEXt section?

The code was very simple: readFileSync then addMetadata with the key/value hello and 42, then writeFileSync to a new file.

Thanks for this excellent library!

Library corrupts PNG footer/end

Hello!

Thank you for the best JS library for writing PNG metadata!

I'm experiencing some image corruption when storing metadata.

Is there a specific version of node I should use to avoid this?

node --version
v16.14.0

Original

achiote

Metadata

achiote-metadata

meta-png v1.0.1 module issue?

I see the new meta-png v1.0.1 on https://www.npmjs.com/package/meta-png. When I do an npm install [email protected], I get only the package.json and the README.md. However, when I npm install [email protected], I get the package.json and the README.md, but also a 'dist' directory with the javascript files in it.

Is there an issue with the meta-png v1.0.1 module, at least the one on npmjs.com? Of course, I could have something messed up in my environment, but I reviewed my setup and I'm not seeing this issue with other modules, so I though it best to ask if anybody else is seeing this issue.

Thank you.

Library sometimes creates invalid pngs

Hey @lucach!

Sorry for me being here again, but one of my users found out an issue regarding png generation.

I'll link his description for better clarity:
FRSOURCE/cypress-plugin-visual-regression-diff#184 (comment)

There are example pngs to be downloaded at the end of his message.

I have confirmed that for some images indeed meta-png is generating invalid PNGs, but I'm not quite sure why yet. I'll will add a comment here if I find anything.

Please let me know if you know what might be the issue ๐Ÿคž

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.