Mathematica 教程 函数 »|教程 »

# 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 (.eps) "PDF" Adobe Acrobat portable document format (.pdf) "SVG" Scalable Vector Graphics (.svg) "PICT" Macintosh PICT "WMF" Windows metafile format (.wmf) "TIFF" TIFF (.tif, .tiff) "GIF" GIF and animated GIF (.gif) "JPEG" JPEG (.jpg, .jpeg) "PNG" PNG format (.png) "BMP" Microsoft bitmap format (.bmp) "PCX" PCX format (.pcx) "XBM" X window system bitmap (.xbm) "PBM" portable bitmap format (.pbm) "PPM" portable pixmap format (.ppm) "PGM" portable graymap format (.pgm) "PNM" portable anymap format (.pnm) "DICOM" DICOM medical imaging format (.dcm, .dic) "AVI" Audio Video Interleave format (.avi)

Typical graphics formats supported by Mathematica. Formats in the first group are resolution independent.

This generates a plot.
 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->72xi thus makes the width xi inches. The default is to produce an image that is four inches wide. ImageSize->{x, y} scales the graphic so that it fits in an x×y region.
 ImageSize Automatic absolute image size in printer's points "ImageTopOrientation" Top how the image is oriented in the file ImageResolution Automatic resolution in dpi for the image

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 (.dxf) "STL" STL stereolithography format (.stl)

Typical 3D geometry formats supported by Mathematica.

 "WAV" Microsoft wave format (.wav) "AU" law encoding (.au) "SND" sound file format (.snd) "AIFF" AIFF format (.aif, .aiff)

Typical sound formats supported by Mathematica.