MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Exports to eps, pdf ImageSize

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99858] Re: Exports to eps, pdf ImageSize
  • From: ragfield <ragfield at gmail.com>
  • Date: Sat, 16 May 2009 05:21:56 -0400 (EDT)
  • References: <gujgd0$or6$1@smc.vnet.net>

On May 15, 5:33 am, bzgra... at hsr.ch wrote:
> Exports of a graphics expression to .pdf (and also .eps) create bigger im=
ages when the files are sent to a printer or a viewer than raster graphics =
as .png, .gif etc. or scalable vector graphics .svg. Setting the ImageSize =
does not solve the problem, unfortunately.
>
> gr = Plot[Cos[x], {x, -2, 2}];
> Export["C:\\test1.pdf", gr, ImageSize -> {360, 224}];
> Export["C:\\test1.eps", gr, ImageSize -> {360, 224}];
> Export["C:\\test1.jpg", gr, ImageSize -> {360, 224}];
> Export["C:\\test1.gif", gr, ImageSize -> {360, 224}];
>
> I also tried many options like ImageMargins, ImagePadding, PlotRangePaddi=
ng, PlotRange, PlotRangeClipping etc. without success.
>
> Why is it that .pdf and .eps create bigger images

Just to clarify, when you say "bigger images" are you referring to the
file size or the image dimensions?

Regarding file size, as you stated, PDF & EPS are vector formats.  In
this particular example they simply contain more data than the raster
formats, resulting in larger file size.

Regarding image dimensions, this is probably a quirk of the viewer
software.  If you examine the PDF or EPS file you see that the
dimensions are correctly specified as 360x224.  If you import the PDF
back into Mathematica you'll see it correctly displayed at 360x224.
If you display it in Preview (or presumably Adobe Reader) it appears
physically larger.  These viewer applications try to be clever by
taking your actual screen resolution into account.  The PDF & EPS
coordinate systems are 72 DPI.  For this example they compute the
desired size to be 5"x3.11".  Then they try to display it as close to
5"x3.11" as possible, rather than at the natural 360x244.

> and how can I compute as exactly as possible the ratios of these relative=
 enlargements? The problem arises in Version 5, 6 and 7 and on different ma=
chines (Windows XP, Switzerland).

You would have to know what the viewer application thinks your
physical screen resolution is.  If it is 100 DPI the graphic would
appear 500x311 pixels.  If it is 133 DPI the graphic would appear
665x414 pixels.  {w,h}*actualDPI/72.

-Rob


  • Prev by Date: creating Graphics using ParallelTable[]
  • Next by Date: Mathematica SIG (Washington DC Area)
  • Previous by thread: Exports to eps, pdf ImageSize
  • Next by thread: Re: Re: Exports to eps, pdf ImageSize