Exporting Graphics

Q: I want to save a Mathematica graphic to a file as a GIF image. Can I export the graphic from a notebook without re-executing the code that created it?

(jfultz@wolfram.com) answers: [Graphics:inoutgr33.gif] can accept a cell expression as well as a graphics expression. Here is a function that pulls the cell expression from the notebook and sends it to [Graphics:inoutgr34.gif], thus avoiding recomputing the graphic in the kernel:

[Graphics:inoutgr3.gif][Graphics:inoutgr35.gif]

This function must be run in the notebook that contains the graphic. The first argument is the name of the file to which [Graphics:inoutgr36.gif] should send its output. The second argument specifies which graphic to save (the n-th graphic in the notebook, counting from top to bottom). The third argument is the file type (such as GIF, EPS, or PDF). For example, this input saves the first graphic in the notebook to the file [Graphics:inoutgr37.gif] as a GIF image:

[Graphics:inoutgr3.gif][Graphics:inoutgr38.gif]