png-chunks-encode
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/png-chunks-encode package

1.0.0 • Public • Published

png-chunks-encode

stable

Return a fresh PNG buffer given a set of PNG chunks. Useful in combination with png-chunks-encode to easily modify or add to the data of a PNG file.

By adding your own tEXt or zEXt chunks you have a useful alternative to LSB steganography for making "magical" images with "secret" data available for your applications: the data is hardly hidden this way, but you can store as much as you like. If you really wanted to, you could probably get away with sneaking a 300MB 3D model in there without too much trouble 👻

Usage

NPM

buffer = encode(chunks)

Takes an array of chunks, each with a name and data:

[
  { name: 'IHDR', data: Uint8Array([...]) },
  { name: 'IDAT', data: Uint8Array([...]) },
  { name: 'IDAT', data: Uint8Array([...]) },
  { name: 'IDAT', data: Uint8Array([...]) },
  { name: 'IDAT', data: Uint8Array([...]) },
  { name: 'IEND', data: Uint8Array([]) }
]

And returns a Uint8Array containing the raw PNG buffer.

See Also

License

MIT, see LICENSE.md for details.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    12,631
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    12,631

Package Sidebar

Install

npm i png-chunks-encode

Weekly Downloads

12,631

Version

1.0.0

License

MIT

Last publish

Collaborators

  • hughsk