PHP Classes

PNG Data Encoder and Container: Encode and decode data inside PNG images

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 531 All time: 5,620 This week: 310Up
Version License PHP version Categories
png-container 1.1GNU General Publi...5.1PHP 5, Graphics
Description Author

This class can be used to encode and decode data inside PNG images.

It can take a string of data or a file and creates an image in PNG format that stores the values of the given data. The generated image can be monochrome or colored.

The class can also do the opposite, i.e. recover the data previously stored in a PNG image.

Innovation Award
PHP Programming Innovation award nominee
September 2010
Number 7

Prize: One license of ScriptCase Enterprise edition
PNG is a format that can be used to store images in a lossless compression format.

This means that a PNG image viewer is able to display the original image colors. This is different from the JPEG lossy compression algorithms that do not guarantee that the original colors can be recovered after decompression.

This property of PNG lossless compression can be used to transmit arbitrary data in a compressed format inside PNG images.

This makes possible to pass binary data to JavaScript running on a browser that supports HTML 5 Canvas. After loading a PNG image sent by the server on a Canvas object, it is possible to recover the original uncompressed data passed inside the PNG image.

This class make it easier to take advantage of this possibility by generating PNG images that embed arbitrary binary data.

It can also do the opposite, i.e, decode binary data submitted to the server eventually from JavaScript using HTML 5 Canvas objects.

Manuel Lemos
Picture of wmchris
Name: wmchris <contact>
Classes: 2 packages by
Country: Germany Germany
Age: 35
All time rank: 2667163 in Germany Germany
Week rank: 606 Up27 in Germany Germany Up
Innovation award
Innovation award
Nominee: 1x

  • example.png
  Files folder image Files  
File Role Description
Plain text file class.pngcontainer.php Class PNG Container Class
Plain text file class.pngencode.php Class PNG Encoding Class
Plain text file N3decode.js Data N3 Decode Class for JS

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:5,620
This week:310Up
For more information send a message to info at phpclasses dot org.