# Rasterize alters the quality of the figure

A quick 3D plot

P1 = ContourPlot3D[x^2 + y^2 + z^2 == 1, {x, -1, 1}, {y, -1, 1}, {z, -1, 1},
Mesh -> None, BoxStyle -> Directive[Black, Thick],
PlotPoints -> 100, PerformanceGoal -> "Speed"]


which looks like

Then I rasterize the image and I export it as an EPS file

rast = Rasterize[P1, RasterSize -> 2000, ImageSize -> 550];
E0 = Export["test.eps", rast, "EPS"];


However when I open the EPS file I see that the thickness of the bounding box is missing.

Is is a bug or I have to use another option so as to keep the style of the bounding box? I use version 9.0 in Windows XP. I have to rasterize the 3D plot instead of E0 = Export["test.eps", P1, "EPS"]; otherwise the EPS file has huge size (more than 100 MB) and in many cases the program crashes.

• Use an explicit thickness, eg Thickness[.01] instead of the generic Thick – george2079 Dec 28 '15 at 15:29
• @george2079 Yes, it's working. Do we know why the generic Thick fail? If you want post a quick answer so as to approve it. – Vaggelis_Z Dec 28 '15 at 15:36

As george2079 correctly points out in the comment, the source of the problem is that you specify thickness of the bounding box as Thick which is evaluated to

Thick

Thickness[Large]


According to the Documentation page for Thickness (see under "Details" section),

The following symbolic forms for $r$ can be used: Tiny, Small, Medium, and Large. These specify absolute thicknesses independent of the overall size of the graphic.

(emphasis mine). This meas that the larger size of the graph you request from Rasterize, the thinner bounding box you obtain. So if you need to make the appearance independent from the size of the graphics you should not use absolute thickness but use relative Thickness (with numeric argument) instead.

And here appears one principal difficulty/ambiguity in how this behavior is documented and how it actually works. It is reasonable to expect that when you specify ImageSize -> 550 you then need not to worry anymore about your thickness irrespectively of which RasterSize (which changes only resolution of the raster image) you specify. It is because according to Documentation page for ImageSize Mathematica assumes that ImageSize is specified in printer's points, while AbsoluteThickness is also specified in printer's points. So it is very natural to expect that when you specify AbsoluteThickness the resulting appearance will not depend on the image resolution! But in the reality AbsoluteThickness is linked not to ImageSize but to RasterSize in contradiction with the Documentation!

In this thread I provide additional arguments and considerations in support of my view that current behavior is inconsistent and wrong. At the bottom of the question in that thread a response from WRI acknowledging this issue is published. Nevertheless I suggest you to report current behavior as a bug again because it moves the problem higher in the WRI's bug priority list.