Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

FITS (.fits, .fit)

  • Import and Export fully support the image, ASCII table, and uncompressed binary table extensions of the FITS file format.
  • BackgroundBackground

      MIME types: application/fits, image/fits
      FITS scientific image and data format.
      Standard format for the exchange and archival storage of astronomical data.
      Endorsed by NASA and the International Astronomical Union.
      FITS is an acronym for Flexible Image Transport System.
      Mixed ASCII and binary format.
      Stores spectral data and raster images as uncompressed arrays.
      Allows format extensions.
      Developed in 1979 by Don Wells, Eric Greisen, and others.

    Import and ExportImport and Export

    • Import["file.fits"] imports a FITS file, returning an image.
    • Export["file.fits",expr] exports graphics or any other expression as an image to a FITS file.
    • When exporting Wolfram Language graphics or arbitrary expressions to FITS, the resulting image has the same raster size as its displayed form.
    • Image objects are by default exported at their raster size.
    • Import["file.fits",elem] imports the specified element from a FITS file.
    • Import["file.fits",{elem,suba,subb,}] imports a subelement.
    • Import["file.fits",{{elem1,elem2,}}] imports multiple elements.
    • The import format can be specified with Import["file","FITS"] or Import["file",{"FITS",elem,}].
    • Export["file.fits",expr,elem] creates a FITS file by treating expr as specifying element elem.
    • Export["file.fits",{expr1,expr2,},{{elem1,elem2,}}] treats each as specifying the corresponding .
    • Export["file.fits",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
    • Export["file.fits",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
    • See the reference pages for full general information on Import and Export.
    • ImportString and ExportString support the FITS format.


    • General Import elements:
    • "Elements" list of elements and options available in this file
      "Rules"full list of rules for each element and option
      "Options"list of rules for options, properties, and settings
    • Image representation elements:
    • "Data"array of adjusted color or grayscale values
      "DataType"data type used to store color or grayscale data in the file
      "Image"raster image object
      "Range"minimum and maximum raw data values
      "Graphics"Graphics object representing an image
      "RawData"array of raw pixel values
    • Import and Export by default use the element for FITS files.
    • Advanced Import elements:
    • "BitDepth"bits used to represent gray-level pixels in the file
      "ColorSpace"color encoding used in the file (typically GrayLevel)
      "ImageSize"raster dimensions
    • General meta-information:
    • "Metadata"raw metadata as stored in the file
      "Comments"comments stored in the file, given as a list of strings
      "History"description of how the data or image has been processed
      "Object"name of the observed object
      "Observer"person who recorded the data or image
      "Organization"organization or institution responsible for creating this file
    • Information about the recording device and environment:
    • "RightAscension"right ascension setting of the telescope axis
      "Declination"declination setting of the telescope axis
      "HourAngle"hour angle of the depicted object when the image was taken
      "SiderealTime"sidereal time (LST)
      "Equinox"equinox for the celestial coordinate system used in this file, typically given in years
      "Airmass"relative airmass
      "ExposureTime"photographic exposure time in seconds
      "ObservationDate"date and time the observation was made
      "Telescope"telescope that captured the image
      "Device"recording instrument (e.g. camera)
    • Bibliographic information elements:
    • "Author"person who compiled the image information
      "Reference"bibliographic reference associated with this file
    • Selecting elements of the table extension of a FITS file:
    • "TableData"data array representing the ASCII table extension
      "TableHeaders"column headers, given as a list of strings
      "TableUnits"units of measurement corresponding to the table columns
      "Plaintext"ASCII table extension represented as a single character string
    • For FITS files that contain multiple images or data extensions, the above elements are taken to be lists of the respective expressions.
    • Metadata field names are converted to all caps on export to conform with FITS standard.


    • General rendering options:
    • ImageSizeAutomaticoverall image size
      ColorFunctionAutomatica function to apply to determine the colors of the raster image
    • Advanced rendering option:
    • "Gamma"1.0gamma correction parameter used for rendering

    ExamplesExamplesopen allclose all

    Basic Examples  (1)Basic Examples  (1)

    Show the import elements available in a sample file:

    Click for copyable input

    Import this file as a graphic, applying a gamma correction to the raw data:

    Click for copyable input
    Click for copyable input

    Read raw metadata from this file:

    Click for copyable input

    Import raw bitmap data from a FITS file:

    Click for copyable input

    Show a logarithmic plot of the data:

    Click for copyable input

    Export the result back to FITS, automatically converting it to a gray-level bitmap:

    Click for copyable input

    Export result with specified metadata:

    Click for copyable input

    Import metadata and comments of the exported file:

    Click for copyable input
    Introduced in 2002
    | Updated in 2014