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

I know that this issue is not LATEX, but I think that it´s usefull for me and for others, because .eps is very used with latex.

I have 15 .eps files of 4 MB, and I note that it´s a little heavy to the viewer and to the compile to PDF.

How could I reduce this size without lossing many quality.

I use imagemagick sometimes.

Here is an example file https://www.dropbox.com/s/7n9hlpszm7m10jc/p01.eps

share|improve this question

2 Answers 2

up vote 6 down vote accepted

There are two reasons why eps files produced by Mathematica (such as p01.eps linked in your question) are often excessively large. The first is specific to Mathematica, but the second seems to be common to a few applications that generate postscript images.

1: Some methods for exporting images (such as right-clicking on the image) will include a large amount of data as comments, in case the file should be loaded back into Mathematica. Use the the Export command to avoid this.

2: Mathematica shades regions in a truly absurd way, using a huge number of small polygons where a few larger ones would do instead. A utility called polygone deals with this by merging shapes that share a common edge.

A version of your file p01.eps that has been processed by polygone 4 (and had the excess comments removed) is available here (409Kb).

EDIT

Prompted by @Bernard's answer, I should point out that the best reduction is usually achieved by converting to pdf after processing with polygone. Converting the file produced by polygone using epstopdf results in a 123Kb image. Not bad when starting from 4.6Mb.

EDIT 03/07/2014

Version 4 of polygone is now available.

share|improve this answer
    
Could you include a sentence at the beginning to explain why you are talking about Mathematica when the question didn't mention it? I realise you must have looked at the code but it may confuse people who don't know, for example, that .eps is a generic format into thinking that it is Mathematica-specific. (Certainly hope it isn't specific anyhow or I'm certainly deluded in thinking I've produced some myself!) –  cfr Jun 15 at 21:50
    
@cfr --- good point. I'll edit the answer. –  Ian Thompson Jun 15 at 21:51
    
:-) @IanThompson , in despite of Ian, I think that Ian have detected thta the graph was created with Mathematica, and I´m very gratefull for your comments. Please if youi edit, don´t delete the explanations about MAtheamtica. –  Mika Ike Jun 15 at 21:55
    
@IanThompson What I finally do is view eps with XnView, SaveAS JPG, and then convert to EPS with imagemagick to get a an eps of 550Kb instead the original 4MB (created and saved, as you detected ;-), with Mathematica). I can´t fin the option Export that you mentioned –  Mika Ike Jun 15 at 22:03
2  
@MikaIke --- If you convert to JPG you will definitely lose quality; JPG is a bitmap format. You should be able to find the Export command in the Mathematica manual (note that it is a command, not an option to be chosen from a menu). –  Ian Thompson Jun 15 at 22:05

You also can convert it to .pdf with Ghostscript and its Windows interface GsView. You'll still have a vector format, and as .pdf is more or less a compressed .ps format, you'll get a rather considerable size reduction — in the case of your file and 600dpi resolution, it is only 660 Kb. Unfortunately I don't know where I could upload the resulting file.

share|improve this answer
    
Yes usually I do it, but in this case, with psmatrix only appears a column of the psmatrix. A few weeks later I ´ll back to this issue. –  Mika Ike Jun 28 at 6:09

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.