# Efficient export of complex graphics to PDF

So I have 2D plot, made with DensityListPlot. Mathematica just cannot export them properly to PDF, so what I want to do is 1) export the plot itself, without axes, labels, etc, as a jpg image, and 2) Inset this image in an empty graphics containing only axes, labels etc. So far so good.

The problem is that when I export the final graphics to PDF, the image are not compressed at all -- and the file end up weighing 400k instead of 30k.

The question is: how do I specify the format and compression factor of images embedded in a pdf?

-
Rasterize the image first maybe? –  fizzics Oct 10 '12 at 10:07
Thanks Chris. I used gs instead of cutepdf to optimise the PDF, and it works very well. Still Wolfram really need to improve PDF export of 2D graphics... –  Mammouth Oct 10 '12 at 10:59
Have you taken a look at [mathematica.stackexchange.com/questions/3190/…, [mathematica.stackexchange.com/questions/1542/…, [mathematica.stackexchange.com/questions/3926/…? My guess is that the size of the file is dictated by the JPEG. Have you tried compressing the JPEG that you export? –  tkott Oct 10 '12 at 14:01
@Mammouth I'm not quite sure why you believe the raster images aren't compressed, but they most certainly are. If you look in the file you can clearly see the /FlateDecode filter applied to the image stream. This is a lossless compression method so it does not achieve as high a compression ratio as a lossy method (like JPEG). –  ragfield Oct 10 '12 at 14:45
@ragfield: fair enough. But how do I tell Mathematica to use jpeg ? –  Mammouth Oct 11 '12 at 19:21