Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

reduce size of eps files of 3D figures

125 views
Skip to first unread message

Michael A. Morrison

unread,
Mar 29, 2012, 5:10:01 AM3/29/12
to
For a book I am writing, I am generating a lot of 3D figures using, for
example, Graphics3D. Many of the resulting Exported *.eps files are huge,
even for a simple case such as a row of three objects such as
Graphics3D[Sphere[]]. These figures will not be printed in color. Is there a
way to generate *.eps files for such a situation that are smaller than those
Exported if one does nothing special? Many thanks in advance. --- michael

Michael A. Morrison
Dept. Physics & Astronomy
University of Oklahoma
Norman, OK 73019
Phone: 405 325-3961
FAX: 405 325-7557
EMAIL: morr...@nhn.ou.edu

JUN

unread,
Mar 30, 2012, 5:35:49 AM3/30/12
to
On Thursday, March 29, 2012 2:10:01 AM UTC-7, Michael A. Morrison wrote:
> For a book I am writing, I am generating a lot of 3D figures using, for
> example, Graphics3D. Many of the resulting Exported *.eps files are huge,
> even for a simple case such as a row of three objects such as
> Graphics3D[Sphere[]]. These figures will not be printed in color. Is there a
> way to generate *.eps files for such a situation that are smaller than those
> Exported if one does nothing special? Many thanks in advance. --- michael

Hi,
here is a new trick that I recently stumbled upon in Mathematica 8: to make Mathematica export all 3D graphics in your notebook in a very efficient way, just execute the following before creating the plots:

Map[SetOptions[#,
Prolog -> {{EdgeForm[], Texture[{{{0, 0, 0, 0}}}],
Polygon[#, VertexTextureCoordinates -> #] &[{{0, 0}, {1,
0}, {1, 1}}]}}] &, {Graphics3D, ContourPlot3D,
ListContourPlot3D, ListPlot3D, Plot3D, ListSurfacePlot3D,
ListVectorPlot3D, ParametricPlot3D, RegionPlot3D, RevolutionPlot3D,
SphericalPlot3D, VectorPlot3D}];

This creates an invisible triangle (with a transparent texture) and adds it as a Prolog to all 3D plotting functions. The mere presence of this invisible element forces Mathematica to give up trying to export EPS and PDF versions made of individual polygons. That's the reason for the large file size. Instead, it decides to use a high-resolution rasterization of your plot and embeds it into the EPS file. I chose to use the Prolog option for this trick because I'm assuming it's rarely used with 3D graphics.

With this, you need to make no changes to any of your subsequent Export commands - the simple form Export["file.eps", plot] will work fine.

More discussion of this (and an example where the file size is reduced rom 200 MByte to 400KByte) is found here:

http://pages.uoregon.edu/noeckel/MathematicaGraphics.html#PDF3D

Jens

da...@wolfram.com

unread,
Mar 31, 2012, 4:42:58 AM3/31/12
to
I often use Rasterize[] on such Graphics and Graphics3D. Brings down the size tremendously.

Daniel Lichtblau
Wolfram Research

0 new messages