Created: 2012-03-20 15:21
Updated: 2013-12-08 01:01
License: other


This is a JavaScript library for reading astronomical data in the PNG format. We implement three custom PNG chunks to store various metadata. One chunk stores a complete FITS header, and another two chunks store quantization parameters and NaN locations when float data has been quantized.


Two dependent libraries are needed to use astropng-js: jDataView and deflate.js.


Include the dependent libraries and astropng-js.

<script src="path/to/jdataview.js" type="text/javascript" charset="utf-8"></script>
<script src="path/to/deflate.js" type="text/javascript" charset="utf-8"></script>
<script src="path/to/astropng.js" type="text/javascript" charset="utf-8"></script>


Using an XMLHttpRequest, retrieve an array buffer or binary string of the AstroPNG.

var xhr = new XMLHttpRequest();'GET', "url/to/astro.png", true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
    ap = new AstroPNG(xhr.response)


Stoehr, F. et al. 2007, ST-ECF Newsletter. 42, 4.

White, Richard L, Perry Greenfield, William Pence, Nasa Gsfc, Doug Tody, and Rob Seaman. 2011. Tiled Image Convention for Storing Compressed Images in FITS Binary Tables: 1-17.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more