S
S
sozercanie_kosmosa2014-08-29 23:39:26
JavaScript
sozercanie_kosmosa, 2014-08-29 23:39:26

How to convert RGBA array to PNG?

Have a good mood!
The crux of the matter: it all comes down to the desire to have a link or an explanation of where to get it.
Subject: you need a library-code in JavaScript (pure without the participation of the server)
that makes an RGBA array -> PNG binary (compression is optional).
Reason: Convert image from Canvas to -> PNG followed by -> Ctrl+S . and everything would be fine, because you can use toDataURL() , but the image is too large and it is not possible to display it in the browser window (a sad smiley flies in Chorme with a suggestion to reload the page).
Thank you in advance.
dated 08/30/2014:
found the project on GitHub (https://github.com/wheany/js-png-encoder ) it basically does what you need, but if you save the result to a file:

var pngFile = generatePng(width, height * cnt, rendBuff); // в файл img.png

then when you open it in the viewer it gives an error.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2014-08-29
@Taraflex

https://github.com/imaya/CanvasTool.PngEncoder
https://github.com/hachque-Emscripten/libpng-1.2.49

D
Dmitry Skogorev, 2014-08-29
@EnterSandman

how big? and if you put chrome x64?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question