FITS (.fits, .fit)


    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.
    Allows multiple header-data units (HDUs).
    Each HDU can be either an image, ASCII table or binary table.
    Stores spectral data and raster images as uncompressed arrays.
    Developed in 1979 by Don Wells, Eric Greisen, and others.

Import and Export

  • Import["file.fits"] imports a FITS file as an image or an array of data values, depending on the HDU type, for a single HDU file.
  • Import["file.fits"] returns an association of the form <|1->hdu1,|> for all HDUs of a multi-HDU file.
  • Import["file.fits",elem] imports the specified element from a FITS file.
  • Import["file.fits",{elem, i}] returns elem stored in the i^(th) HDU.
  • The import format can be specified with Import["file","FITS"] or Import["file",{"FITS",elem,}].
  • Export["file.fits",expr] exports images and graphics as an image to a FITS file, at their raster sizes.
  • Export["file.fits",expr] exports string and numeric arrays as a table to a FITS file.
  • 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
  • Structure elements:
  • "HDUCount"number of HDUs
    "Extensions"type of the HDU extensions
    "Summary"summary of the file
    "SummarySlideView"slide-view summary of all HDUs
  • For all elements for single-HDU files, a single value is returned. For multi-HDU files, a numbered association is returned in the form <|1->val1,2->val2,|>.
  • Data representation elements:
  • "Data"array of pixel values or table elements
    "DataType"data type used to store image or table data in the file
    "Plaintext"representation of image and table extensions as a string
    "Range"minimum and maximum raw data values
    "RawData"raw data as stored in the file
  • Additional elements, available for image HDUs:
  • "Graphics"raster image, given as a Graphics object
    "Image"raster image, given as an Image object
    "IndeterminateMask"a sparse array representing indeterminate values in the image
  • Additional elements, available for binary and ASCII table HDUs:
  • "TableData"representation of table extension
    "TableHeaders"table column headers
    "TableUnits"units of measurement corresponding to the table columns
  • Import and Export by default use the "Image" element for image HDUs, and the "Data" element for binary and ASCII tables.
  • Advanced Import elements:
  • "BitDepth"bits used to represent gray-level pixels in the file
    "Channels"the number of color channels used in the file
    "ColorSpace"color encoding used in the file
    "Dimensions"data dimensions
    "ImageSize"raster dimensions of a single frame
  • General metadata elements:
  • "MetaInformation"processed metadata
    "RawMetaInformation"raw metadata as stored in the file
  • Other common metadata elements:
  • "Comments"comments for each data or image stored in the file
    "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:
  • "Airmass"relative airmass
    "Declination"declination setting of the telescope axis
    "Device"recording instrument (e.g. camera)
    "Equinox"equinox for the celestial coordinate system used in this file, typically given in years
    "ExposureTime"photographic exposure time in seconds
    "HourAngle"hour angle of the depicted object when the image was taken
    "ObservationDate"date and time the observation was made
    "RightAscension"right ascension setting of the telescope axis
    "SiderealTime"sidereal time (LST)
    "Telescope"telescope that captured the image
  • Bibliographic information elements:
  • "Author"person who compiled the image information
    "Reference"bibliographic reference associated with this file
  • Metadata field names are converted to all caps on export to conform with FITS standard.


  • Import and Export option:
  • DataReversedAutomaticwhether to reverse the order of rows
  • Import options:
  • ColorFunctionAutomatichow each cell should be colored
    ImageSizeAutomaticoverall image size
    "Gamma"1.0gamma correction parameter used for rendering
    "IncludeExtensions"AllHDU extensions to import
    "IncludeHeaders"Falsewhether to import table headers
  • Export options:
  • "Append"Falsewhether to append to an existing file
    "CompressionMethod"Nonecompression algorithm to use on export
  • Possible settings for "CompressionMethod" include "GZIP", "GZIPShuffled", "Rice", "HCompress" and "PLIO".


open allclose all

Basic Examples  (3)

Import a FITS file containing image data:

Click for copyable input

Import a FITS file with multiple HDUs:

Click for copyable input

Export an image to FITS:

Click for copyable input

Scope  (4)

Import Elements  (39)

Export Elements  (5)

Import Options  (6)

Export Options  (2)

See Also

"CDF"  "GIF"  "HDF"  "HDF5"  "JPEG"  "NetCDF"  "PNG"  "TIFF"

Introduced in 2002
| Updated in 2018