5 ms·
Well done! Im looking for a png parser in javascript. I would like to load pngs with xmlhttprequest and them draw them on a canvas. Ever heard of one?
by icode 16y ago
Well done! Im looking for a png parser in javascript. I would like to load pngs with xmlhttprequest and them draw them on a canvas. Ever heard of one?
- de90 16y agoWhy not just do something like the below when you need to do that? var img = new Image(); img.onload = function(){ //draw to canvas }; img.src = "image.png"; Could be a stupid answer, or possibly it'd be better to do it your way?( Maybe I can learn something :) )
- TimothyFitz 16y agoAll major browsers will now do this for you, with data: urls. Take a look at the examples here: http://en.wikipedia.org/wiki/Data_URI_scheme http://en.wikipedia.org/wiki/Data_URI_scheme
- capnrefsmmat 16y agoThis may be helpful: https://developer.mozilla.org/en/Canvas_tutorial/Using_images#drawImage https://developer.mozilla.org/en/Canvas_tutorial/Using_image...