Join the DZone community and get the full member experience.Join For Free
- Read the binary data of the ZIP file from the server via XMLHttpRequest. You need to specify a charset x-user-defined to ensure that each byte stays a single character.
- Translate the binary data to base 64 and turn it into a PNG data URI. PNG is zipped internally, so if you get the header right, the web browser will unzip the data as soon as the image is drawn somewhere.
- Draw the image into a Canvas object, with a height of 1 pixel. Read the uncompressed data from the Canvas, pixel by pixel.
Published at DZone with permission of Axel Rauschmayer , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.