This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

ImportImportString

Export

FilledSmallSquareExport["file.ext", expr] exports data to a file, converting it to a format corresponding to the file extension ext.

FilledSmallSquareExport["file", expr, "format"] exports data to a file, converting it to the specified format.

FilledSmallSquareExport can handle numerical and textual data, graphics, sounds, and material from notebooks.

FilledSmallSquare The following basic formats are supported for numerical and textual data:

FilledSmallSquare In "CSV", "List" and "Table" format, numbers are written in C or Fortran-like "E" notation when necessary.

FilledSmallSquare Machine-precision numbers are written to six-digit precision by default.

FilledSmallSquare In "CSV" format, columns are separated by commas.

FilledSmallSquare In "Table" format, columns are separated by spaces.

FilledSmallSquareExport["file.txt", expr] uses "Text" format.

FilledSmallSquareExport["file.dat", expr] uses "Table" format.

FilledSmallSquare The following additional formats are also supported for numerical and textual data:

FilledSmallSquare All graphics formats in Export can handle any type of 2D or 3D Mathematica graphics.

FilledSmallSquare They can also handle Notebook and Cell objects.

FilledSmallSquare In some formats, lists of frames for animated graphics can be given.

FilledSmallSquare The following options can be given when exporting graphics:

FilledSmallSquare The following graphics formats are independent of the setting for ImageResolution:

FilledSmallSquare The following graphics formats depend on the setting for ImageResolution:

FilledSmallSquare The following three-dimensional graphics formats are supported:

FilledSmallSquare The following sound formats are supported:

FilledSmallSquare The following XML document formats are supported:

FilledSmallSquare In Export["file", expr, "MathML"], expr will generally be treated as a mathematical expression and converted to a traditional mathematical presentation in MathML. If expr is a box structure, it will be converted into the corresponding MathML presentation elements.

FilledSmallSquare In Export["file", expr, "NotebookML"], expr must be either a notebook, cell, or box expression; a notebook object; or a notebook file.

FilledSmallSquare If "XML" is specified as the export format, notebook or cell expressions and notebook objects will be exported as NotebookML; other expressions will be exported as ExpressionML.

FilledSmallSquareNotebook and Cell objects, as well as any box expression obtained from ToBoxes, can be exported in the following formats:

FilledSmallSquare These formats generate markup material, which maintains much of the document structure that exists within Mathematica.

FilledSmallSquare With HTML and TeX formats Export operates like HTMLSave and TeXSave.

FilledSmallSquare Many details can be specified in the setting for ConversionOptions.

FilledSmallSquare The following general options can be given:

FilledSmallSquare Possible formats accepted by Export are given in the list $ExportFormats.

FilledSmallSquareExport["!prog", expr, "format"] exports data to a pipe.

FilledSmallSquare See The Mathematica Book: Section 1.11.3, Section 2.9.19 and Section 2.11.7.

FilledSmallSquare See also: Import, ExportString, $ExportFormats, Display, Write, Put.

Additional Information

Many Export formats have private options that are specified using the option ConversionOptions: Export["file", expr, "format", ConversionOptions -> opts].

AIFF

The following option can be given:

FilledSmallSquare The default setting is "SampleDepth" -> 8 unless a different depth is explicitly specified in the Sound object. Sound can be exported to "AIFF" with a "SampleDepth" of 8 or 16.

AU

The following option can be given:

FilledSmallSquare The default setting is "SampleDepth" -> 8, which creates a mu-law 8-bit encoded sound file, unless a different depth is explicitly specified in the Sound object.

FilledSmallSquareSound can be exported to "AU" with a "SampleDepth" of 8, 16, or 32.

BMP

The following option can be given:

CSV

The following option can be given:

DXF

The following option can be given:

ExpressionML

In addition to the options listed for "XML", the following option can be given:

FilledSmallSquare The setting for "Annotations" is a list which may include any number of the choices "DocumentHeader", "XMLDeclaration", and "DOCTYPEDeclaration".

FITS

The following option can be given:

FilledSmallSquare The option "BITPIX" determines whether data is represented as integer or real data. It also determines the number of bytes used to store each number.

FilledSmallSquare The option "BITPIX" can be any of the following values:

FilledSmallSquare The "BITPIX" option cannot be used to alter the data. It must be possible to express the data in the requested form.

FilledSmallSquare The "BITPIX" option does not override the "BITPIX" entry in any headers. Only if there is no header or a header without a "BITPIX" entry will the option be used.

FilledSmallSquare Export accepts a list of Header Data Units (HDUs). Each HDU is a list containing a header and a data unit. If headers are not provided, a basic header is automatically generated.

FilledSmallSquare Each header is a list of entries of the form entry_String "Value" val_, "Comment" com_String or, for entries with no comment, entry_String val_

FilledSmallSquare Data units are tensors. A 0-dimensional tensor is represented by Null.

FilledSmallSquare The primary HDU, IMAGE extensions, and ASCII table extensions are supported.

GIF

The following options can be given:

FilledSmallSquare"Background" -> RGBColor[r, g, b] sets the background color of the exported GIF to the specified graphics directive. Many applications will ignore this setting and will also not display this color if there is no transparency set.

FilledSmallSquare"ColorReductionDither" -> True will provide better resulting images once a color map is chosen by dithering the image.

FilledSmallSquare"ColorReductionPalette" -> Automatic will choose an adaptive set of at most 256 colors. "ColorReductionPalette" -> n will choose at most n colors for the color palette. "ColorReductionPalette" -> , , ... specifies a list of color directives to use to color reduce the image. The values for must be CMYKColor, GrayLevel, Hue, or RGBColor directives. The number of colors chosen for "ColorReductionPalette" must be between 2 and 256.

FilledSmallSquare The following example produces a color map of "browser safe" 216 colors: Export["file.gif", gr, "GIF", ConversionOptions -> {"ColorReductionPalette" -> Table[RGBColor[i,j,k], {i,0,1,0.2},{j,0,1,0.2},{k,0,1,0.2}] }].

FilledSmallSquare"Transparency" -> RGBColor[r, g, b] requests that the specified color directive defines the transparent color for the exported GIF. "Transparency" -> GrayLevel[1] defines white as the transparent color. By default, an adaptive "ColorReductionPalette" is used to produce the GIF color palette, and this, in some cases, could produce a set of colors that does not contain the transparent color requested.

FilledSmallSquare A list of graphics objects exported to the GIF format will produce an animated GIF.

FilledSmallSquare The following additional options can be given when exporting as an animated GIF:

FilledSmallSquare"AnimationDisplayTime" -> n sets the delay time in seconds for each frame. By default no delay time is used. If a list of delay times is used, the sequence of delay times is applied to the entire list of frames, repeating the delay time sequence if necessary.

FilledSmallSquare The option "Disposal" tells an application what should replace each frame after the frame is done displaying. The option can have the values of None, False, Background, or Previous. The default setting of "Disposal" -> None will not do anything, and with no transparency in the GIF, this setting will have no noticeable effect. However, if you are creating a transparent GIF animation, you will usually want "Disposal" -> Background as this will clear each frame in the animation before the next frame is displayed, otherwise you will see each frame image drawn on top of the other.

FilledSmallSquare When exporting a list of images for an animated GIF, "GlobalColorReduction" -> True will build one color reduction palette from all images to get one global color map used by the entire GIF, as opposed to building a unique color map for each frame, which could increase the size of the resulting animated GIF.

FilledSmallSquare"Loop" -> True will create an animated GIF that will loop forever, while "Loop" -> n will make the animation loop n times.

FilledSmallSquare With the setting "Pause" -> True, user intervention is required for the animated GIF to continue to the next frame. Currently, there are very few applications that support this feature of the GIF format.

HDF

The following options can be given:

FilledSmallSquare With the setting "Append" -> True, the HDF dataset is appended to the existing file instead of completely replacing any existing file. The file is created if it does not already exist.

FilledSmallSquare With the default setting of "FormatType" -> Automatic, a multidimensional array of integers is exported as an array of 32-bit integers, and real arrays are exported as an array of 32-bit reals. If an array contains a mixture of integers and reals, all data in the array will be exported as reals. All values are exported modulo the specified data format size limits.

FilledSmallSquare"FormatType" can be set to the following possible binary formats:

FilledSmallSquare With the default setting "Interface" -> Automatic, data will be written using the "SDS" interface. If FormatType is either "Real32" or Automatic when exporting real data, the older "SDG" format is used which only supports 32-bit reals and can be read by older HDF applications. "Interface" -> "SDS" will force the use of the newer "SDS" interface.

FilledSmallSquare Export of HDF currently only supports the "scientific datasets" SDS interface.

HTML

All of the options to HTMLSave are also options that can be used in ConversionOptions when exporting to "HTML".

JPEG

The following options can be given:

FilledSmallSquare The option "Colorspace" can be explicitly set to RGBColor or GrayLevel to force the resulting image to a specific color space.

FilledSmallSquare The "Quality" factor determines the quality and size of an exported JPEG, 0 being the lowest quality and smallest file size, and 100 being the highest quality and largest file size.

FilledSmallSquare A smoothing factor can be used to smooth the resulting JPEG image. "Smoothing" -> 0 performs no smoothing, and "Smoothing" -> 100 provides maximum smoothing.

MathML

In addition to the options listed for "XML", the following options can be given:

FilledSmallSquare The setting for "Annotations" is a list which may include any number of the choices "DocumentHeader", "XMLDeclaration", and "DOCTYPEDeclaration".

NotebookML

In addition to the options listed for "XML", the following options can be given:

FilledSmallSquare The setting for "Annotations" is a list which may include any number of the choices "DocumentHeader", "XMLDeclaration", "DOCTYPEDeclaration", and "StyleAdvisories".

PBM, PGM, PPM, PNM

The following option can be given:

FilledSmallSquare With the default setting "FormatType" -> Automatic, a PBM image will normally be saved as a raw binary PBM file if the number of colors in the image is below the maximum number of levels for a binary format, otherwise the image will be saved in ASCII text PBM format. "FormatType" -> "Text" will force the use of the ASCII text PBM format.

STL

The following options can be given:

FilledSmallSquare The default setting "SurfaceOrientation" -> Automatic results in no orientation applied to triangles.

FilledSmallSquare Setting "SurfaceOrientation" -> x, y orients all triangles such that the "top" of each triangle faces the point.

FilledSmallSquare Specifying "SurfaceOrientation" -> Infinity orients all triangles so that they face away from the origin.

TeX

All of the options to TeXSave are also options that can be used in ConversionOptions when exporting to "TeX".

TIFF

The following options can be given:

FilledSmallSquare TIFF images can be saved in different byte ordering formats. By default the byte ordering for the current platform is used. ByteOrdering -> 1 or ByteOrdering -> -1 will force the use of a specific byte ordered TIFF.

FilledSmallSquare The option "Compression" can have the values None, "Packbits", "LZW", "JPEG", or "ZIP". A TIFF exported with "LZW", "JPEG", or "ZIP" compression schemes may not be recognized by certain applications.

FilledSmallSquare TIFF images can be saved in a meshed or planar configuration. "Planes" -> "Single" stores RGBColor data in an "RGBRGB..." order, while "Planes" -> "Multiple" stores the data as "RRR...GGG...BBB...".

FilledSmallSquare The "Predictor" option is only used with "LZW" and "ZIP" compression schemes and can be set to either None or "HorizontalDifferencing". Depending upon the contents of the image, a different "Predictor" value could result in better compression.

FilledSmallSquare The option "ImageScaling" determines whether exported data is scaled to standard byte values or whether the "MaxValue" TIFF tag is used and the data is left unscaled. Some applications do not correctly check the "MaxValue" TIFF tag and may display images incorrectly if this method is used.

FilledSmallSquare A list of graphics objects can be exported to the TIFF format and each image will be stored in a TIFF directory of the file. Some applications will only read the first image of a TIFF file containing multiple images.

WAV

The following option can be given:

FilledSmallSquare The default setting is "SampleDepth" -> 8 unless a different depth is explicitly specified in the Sound object. Sound can be exported to "WAV" with a "SampleDepth" of 8 or 16.

XML

The form of output produced by Export[file", data, "XML"] depends on the kind of data being exported.

When the data to be exported is a symbolic XML expression, (as obtained from Import["file", "SymbolicXML"], for example), the symbolic expression is converted into XML text.

When the data to be exported is a notebook or cell expression, NotebookML is generated. For expressions that are neither symbolic XML nor notebooks nor cells, ExpressionML is generated. For these cases, see the options listed for NotebookML and ExpressionML.

The following options may be given for any form of XML:

ImportImportString