Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I export a graphics from Mathematica to JPG format the image quality in JPG is visibly lower than that in Mathematica. Is it possible to control and eventually increase the quality of the exported to JPG graphics?

To be precise, I need to make a 3D image out of a list obtained by a simulation using another software, but post-processed in Mathematica. My original list is too large. For this example let us take this:

lst = RandomReal[{-5, 5}, {10000, 3}] /. {x_, y_, z_} -> {x, y, 
 Exp[-(x^2 + y^2)/3] + 0.0001*z};

I make the graphics and export it into the PDF file using these standard operations:

    pl1 = ListPlot3D[lst, PlotRange -> All, 
  ColorFunction -> Function[{x, y, z}, Hue[0.9 z + 0.1]]]
Export[NotebookDirectory[] <> "exportTrial.jpg", pl1, "JPG"]

My exported file, though not really bad, looks much poorer than the original image visible in Mathematica.

Just to explain the awkwardness of the statement of my question. I know that export into, say, PDF file (and some others) makes a much better quality. However, the image I am making will be submitted as an illustration to an article, and the JPG format is the journal requirement that cannot be circumvented. On the other hand, this journal requires a high quality graphics.

My secondary question: is it possible to reproduce the effect of the Glow[] function in the exported JPG file? I tried the graphics in such a form:

pl2 = ListPlot3D[lst, PlotRange -> All, 
  ColorFunction -> Function[{x, y, z}, Glow[Hue[0.9 z + 0.1]]]]

Export[NotebookDirectory[] <> "exportTrial.jpg", pl2, "JPG"]

but the difference between the images with and without Glow quite visible in Mathematica is not really visible in the resulting JPG files. My ultimate aim related to this latter question is to make the image a bit brighter.

share|improve this question
up vote 9 down vote accepted

In the help file for Jpeg, there is the option to control the quality of the export. The default value of CompressionLevel is 0.25. Decreasing this will help to give better jpegs. The other thing you can do is to set the ImageSize larger. This creates a larger picture that gets compressed into jpeg, again improving the resolution. So together, these are:

pl1 = ListPlot3D[lst,PlotRange -> All,ColorFunction -> Function[{x, y, z},  
     Hue[0.9 z + 0.1]], ImageSize->1000]
Export[NotebookDirectory[] <> "exportTrial.jpg", pl1, "JPG", "CompressionLevel"->0]

I think you may find that increasing the resolution like this also fixes your Glow problem.

share|improve this answer
Thank you very much. It helps. – Alexei Boulbitch Jun 4 '13 at 10:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.