Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
Rasterize the image first maybe? –  fizzics Oct 10 '12 at 10:07
    
This is precisely what I do, but Export does not compress the raster image. –  Mammouth Oct 10 '12 at 10:36
3  
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
1  
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
1  
@ragfield: fair enough. But how do I tell Mathematica to use jpeg ? –  Mammouth Oct 11 '12 at 19:21
show 2 more comments

1 Answer

Try using EPS as export format (e.g. Export["filename.eps", img], then converting the resulting file to PDF with epstopdf or ps2pdf. This produces much better results than Mathematica's PDF export in most cases.

share|improve this answer
    
Doesn't solve all problems. –  alancalvitti Feb 5 '13 at 0:08
add comment

Your Answer

 
discard

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.