Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Visualize complex images with WebGL
JavaScript Shell Python CSS
branch: master
Failed to load latest commit information.
examples check GPU max texture size and downsample on the fly
scripts bug fix to prevent gl errors
src another check to conserve memory
.gitignore abstracting layering
LICENSE clean up examples, tweaks to api add doc on colormaps
bower.json downsampling
package.json another check to conserve memory
rawimage.js another check to conserve memory
rawimage.min.js another check to conserve memory updated readme and setup


A JavaScript library to visualize astronomical images in a web browser. This library contains a set of functions that are frequently used to visualize the high dynamic range of astronomical images.


setupControls(mouseCallbacks, opts)

Enable panning and zooming on the visualization context. mouseCallbacks is an optional argument. Providing an object with functions defined on the following keys will hook into WebFITS mouse events. See examples/webgl-single-image-mouse-callbacks.html for an example.

  • onmousedown
  • onmouseup
  • onmousemove
  • onmouseout
  • onmouseover

opts is a second optional argument that can be used to pass values to the mouse callbacks.

loadImage(identifier, arr, width, height)

Load an image into the visualization. identifier is a user chosen name for the image. arr is a typed array representing the image of width and height.


After loading images with loadImage, a specific image may be selected using this function.

setExtent(min, max)

Set the minimum and maximum pixels values that will be rendered.


Sets the stretch for the image, the default is linear. Current valid values for stretch

  • linear
  • logarithm
  • sqrt
  • arcsinh
  • power


Set a colormap for the image. Default colormap is grayscale. Any colormap listed in ColorMaps may be used.

setScales(r, g, b)

This function is relevant to color composites, setting a normalized scale for each rgb channel.


This function is relevant to color composites, setting the alpha parameter in the modifed Lupton algorithm.


This function is relevant to color composites, setting the Q parameter in the modifed Lupton algorithm.

drawColor(r_identifier, g_identifier, b_identifier)

Render a color composite by specifying the identifiers for each channel. Note: setScales, setAlpha, and setQ must be called prior to this function. WebFITS does not provide default values.


Examples may be found in the examples directory. To get started run:


This script downloads the latest version of fits.js and sample images needed for the examples. A local server is needed to see the examples. If familiar with Node.js, you may install development dependencies by running:

npm install .

and spin up a local server



Something went wrong with that request. Please try again.