Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encoding a PNG with JavaScript

I have some arbitrary pixel data that I want to save as a PNG. How can I encode a PNG with JavaScript to accomplish this?

The data is a series of 1's and 0's that I want to use to create a QR code. It's QR code arbitrary data

I'm not using the DOM, so jQuery and createElement's are out.

like image 966
Shamoon Avatar asked Jul 02 '12 15:07

Shamoon


2 Answers

http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/

like image 140
snies Avatar answered Oct 14 '22 00:10

snies


Or encode it directly to a PNG with pure javascript (no canvas required):

https://github.com/IjzerenHein/pnglib-es6

like image 26
IjzerenHein Avatar answered Oct 14 '22 00:10

IjzerenHein