# Quality control when exporting graphics into JPG

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.

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.

It is not about ImageSize, is ImageResolution what you are looking for.

Just do the following,

 YOURdpi=2000;
Export["mygraph.png", ImageResolution->YOURdpi];

• Thank you very much, I will try this. Commented May 24, 2018 at 7:02