Exporting Graphics and Sounds
Mathematica allows you to export graphics and sounds in a wide variety of formats. If you use the notebook front end for
Mathematica, then you can typically just copy and paste graphics and sounds directly into other programs using the standard mechanism available on your computer system.
| Export["name.ext",graphics] | export graphics to a file in a format deduced from the file name |
| Export["file",graphics,"format"] | export graphics in the specified format |
| Export["!command",graphics,"format"] | export graphics to an external command |
| Export["file",{g1,g2,...},...] | export a sequence of graphics for an animation |
| ExportString[graphics,"format"] | generate a string representation of exported graphics |
Exporting Mathematica graphics and sounds.
| "EPS" | Encapsulated PostScript ( ) |
| "PDF" | Adobe Acrobat portable document format ( ) |
| "SVG" | Scalable Vector Graphics ( ) |
| "PICT" | Macintosh PICT |
| "WMF" | Windows metafile format ( ) |
| "TIFF" | TIFF ( , ) |
| "GIF" | GIF and animated GIF ( ) |
| "JPEG" | JPEG ( , ) |
| "PNG" | PNG format ( ) |
| "BMP" | Microsoft bitmap format ( ) |
| "PCX" | PCX format ( ) |
| "XBM" | X window system bitmap ( ) |
| "PBM" | portable bitmap format ( ) |
| "PPM" | portable pixmap format ( ) |
| "PGM" | portable graymap format ( ) |
| "PNM" | portable anymap format ( ) |
| "DICOM" | DICOM medical imaging format ( , ) |
| "AVI" | Audio Video Interleave format ( ) |
Typical graphics formats supported by Mathematica. Formats in the first group are resolution independent.
| Out[1]= |  |
This exports the plot to a file in Encapsulated PostScript format.
| Out[2]= |  |
When you export a graphic outside of
Mathematica, you usually have to specify the absolute size at which the graphic should be rendered. You can do this using the
ImageSize option to
Export.
ImageSize->x makes the width of the graphic be
x printer's points;
ImageSize
thus makes the width
xi inches. The default is to produce an image that is four inches wide.
ImageSize
scales the graphic so that it fits in an
x×
y region.
Options for Export.
Within
Mathematica, graphics are manipulated in a way that is completely independent of the resolution of the computer screen or other output device on which the graphics will eventually be rendered.
Many programs and devices accept graphics in resolution-independent formats such as Encapsulated PostScript (EPS). But some require that the graphics be converted to rasters or bitmaps with a specific resolution. The
ImageResolution option for
Export allows you to determine what resolution in dots per inch (dpi) should be used. The lower you set this resolution, the lower the quality of the image you will get, but also the less memory the image will take to store. For screen display, typical resolutions are 72 dpi and above; for printers, 300 dpi and above.
| "DXF" | AutoCAD drawing interchange format ( ) |
| "STL" | STL stereolithography format ( ) |
Typical 3D geometry formats supported by Mathematica.
Typical sound formats supported by Mathematica.