Pure JavaScript PNG decoder