1

I have read those posts like How to reduce the size of an .eps file? , Eps file is so large [closed] ,Sun life: Linux: how to reduce eps file size? but find little can help my problem.

Sun life: Linux: how to reduce eps file size? this can be used for some figures of my paper but not for all just as the comments mentioned.

So I upload my mange.tex code first, because I use this to combine all sub-figures.

here is the vector.eps needed:

vector0.eps

vector1.eps

vector2.eps

    % Rusting Iron
% Author: Jason Waskiewicz
% A "jazzy" picture of the stages of rust (presented for a high school level).
% Iron is red, oxygen is blue and electrons are black. At the left you see
% iron atoms with two oxygen molecules, then the electrons go to the oxygen molecules
% leaving oxygen ions and iron ions which then disolve.
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}
\usepackage{lmodern}
\newcommand{\tikzmark}[2]{\tikz[remember picture, baseline] \node[inner sep=0pt, outer sep=0pt, anchor=base] (#1) {#2};}

\newcommand{\ZuiDa}{\fontsize{72pt}{0.5pt}}

\begin{document}

\begin{tikzpicture}[ >=stealth, %show background rectangle, iron/.style={ball color=red}, electron/.style={ball color=green}, oxygen/.style={ball color=blue}, B/.style={ball color=yellow}, A/.style={ball color=violet}, Dark/.style={ball color=black}, ]

\def\r{1.0} \def\xshiftdist{18} \def\xdoubleshiftdist{36} \def\xtripleshiftdist{50}

\node (A) at(0,0) { {\includegraphics[width=5.5\textwidth]{vector0.eps}} };

\draw (-36,0.0) node { \ZuiDa \textbf{(\emph{a})}};

%上墙 \draw [line width = 15 mm] (-34,5) -- (34,5) ;

%Period 1

\foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron] (\x,-5.3,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron] (\x,-5.3,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen] (\x,-5.3,0) circle (\r);

%Period 2 %,xshift = \xshiftdist cm

\foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron,xshift = \xshiftdist cm] (\x,-5.3,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron,xshift = \xshiftdist cm] (\x,-5.3,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen,xshift = \xshiftdist cm] (\x,-5.3,0) circle (\r);

%Period 3 ,xshift = \xdoubleshiftdist cm

\foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron,xshift = \xdoubleshiftdist cm] (\x,-5.3,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron,xshift = \xdoubleshiftdist cm] (\x,-5.3,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen,xshift = \xdoubleshiftdist cm] (\x,-5.3,0) circle (\r);

%Period 4 %,xshift = \xtripleshiftdist cm

\foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron,xshift = \xtripleshiftdist cm] (\x,-5.3,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron,xshift = \xtripleshiftdist cm] (\x,-5.3,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen,xshift = \xtripleshiftdist cm] (\x,-5.3,0) circle (\r);

% % (b) % \def\rptwoUP{-10.5} \def\rptwoDOWN{-19.5}

\node[right=of A] (B) at (-35,-15){ {\includegraphics[width=5.5\textwidth]{vector1.eps}} }; \draw (-36,-15.0) node { \ZuiDa \textbf{(\emph{b})}};

%Period 1 %%up \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-25.00000} \draw [Dark] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen] (\x,\rptwoUP,0) circle (\r);

%%down \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen] (\x,\rptwoDOWN,0) circle (\r);

%Period 2 %,xshift = \xshiftdist cm %%up \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron,xshift = \xshiftdist cm] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-25.00000} \draw [Dark,xshift = \xshiftdist cm] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen,xshift = \xshiftdist cm] (\x,\rptwoUP,0) circle (\r);

%%down \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron,xshift = \xshiftdist cm] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron,xshift = \xshiftdist cm] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen,xshift = \xshiftdist cm] (\x,\rptwoDOWN,0) circle (\r);

%Period 3 ,xshift = \xdoubleshiftdist cm %%up \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron,xshift = \xdoubleshiftdist cm] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-25.00000} \draw [Dark,xshift = \xdoubleshiftdist cm] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen,xshift = \xdoubleshiftdist cm] (\x,\rptwoUP,0) circle (\r);

%%down \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron,xshift = \xdoubleshiftdist cm] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron,xshift = \xdoubleshiftdist cm] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen,xshift = \xdoubleshiftdist cm] (\x,\rptwoDOWN,0) circle (\r);

%Period 4 %,xshift = \xtripleshiftdist cm

% % c %

\def\rptwoUP{-24.2} \def\rptwoDOWN{-34}

\node[right=of A] (B) at (-35,-29){ {\includegraphics[width=5.5\textwidth]{vector2.eps}} }; \draw (-36,-28.0) node { \ZuiDa \textbf{(\emph{c})}};

%%up \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [oxygen] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-25.00000} \draw [Dark] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [iron] (\x,\rptwoUP,0) circle (\r);

%%down \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen] (\x,\rptwoDOWN,0) circle (\r);

%Period 2 %,xshift = \xshiftdist cm %%up \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [oxygen,xshift = \xshiftdist cm] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-25.00000} \draw [Dark,xshift = \xshiftdist cm] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [iron,xshift = \xshiftdist cm] (\x,\rptwoUP,0) circle (\r);

%%down \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron,xshift = \xshiftdist cm] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron,xshift = \xshiftdist cm] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen,xshift = \xshiftdist cm] (\x,\rptwoDOWN,0) circle (\r);

%Period 3 ,xshift = \xdoubleshiftdist cm
%%up \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [oxygen,xshift = \xdoubleshiftdist cm ] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-25.00000} \draw [Dark,xshift = \xdoubleshiftdist cm ] (\x,\rptwoUP,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [iron,xshift = \xdoubleshiftdist cm ] (\x,\rptwoUP,0) circle (\r);

%%down \foreach \x in {-33.00000, -31.00000, -29.00000, -27.00000} \draw [iron,xshift = \xdoubleshiftdist cm ] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-25.00000} \draw [electron,xshift = \xdoubleshiftdist cm ] (\x,\rptwoDOWN,0) circle (\r);

\foreach \x in {-23.00000, -21.00000,-19.00000, -17.00000} \draw [oxygen,xshift = \xdoubleshiftdist cm ] (\x,\rptwoDOWN,0) circle (\r); %node[right=of B] (C) at (-2.641,-2.15){ %{\includegraphics[width=.5\textwidth]{system5.pdf}} %}; \end{tikzpicture} \end{document}

this will create a PDF figure and I then use

pdfcrop  --margins '0 0 -908 0' mange.pdf output.pdf 

to get the final result it is like this:

enter image description here

I provide it here : output.pdf 523.kB

but I am required to convert this pdf to eps, so I use the following command:

 pdftops -eps output.pdf 

the resulting eps file is like this:

 pdftops -eps output.pdf 

I provide it here : output.eps 2.3MB

But now I need to further reduce the size of the eps format to like 500 ~ 800 kB as the publication requires.

SO How can I realize this.

Basically I have two kinds of ideas:

  1. directly reduce eps file, like this post Thread: Resizing Eps/ps files but I am confused with the last methods methods mentioned e.g.

Open the EPS file with it and add the following line after the EPS header (where sx and sy are the factor values you need to rescale the image to the required size).

Following this idea, I use GIMP to scale the eps files but I seems that this will harm the quality of the figures. What a pity!

  1. I directly convert figure to eps in Tikz,so I check the posts like Export eps figures from TikZ,Convert TikZ to EPS using pdfLaTeX But this seem further complexes the problem.That's the reason I provide the Tikz code.

So any ideas? How should I do?

Thank you!

==============================================

Thanks to cfr's advice I tried but the effect seems strange like the picture below:

enter image description here

Why the color seems so weak?

sikisis
  • 225
  • 1
    Can you make the files vector0.eps, vector1.eps and vector2.eps available for download from somewhere and add a link here? Preferably somewhere that does not require an account to download the files. – Ian Thompson Nov 26 '15 at 19:36
  • Perhaps try running the EPS through eps2eps. – Werner Nov 26 '15 at 20:03
  • @IanThompson OK, I provided them – sikisis Nov 27 '15 at 04:30
  • @Werner I tried your method but it seems that the file will be larger. for example, I use eps2eps output.eps new.eps to try this command but the output new.eps is 15.7MB much bigger than the original 2.7MB of output.eps. – sikisis Nov 27 '15 at 04:37
  • Can you present the 3 files as sub-figures within a figure so that you don't need to combine them into one file? If the maximum size is per file and not a total, that is. It would be fairly straightforward, depending on the publisher's other requirements, to just use all three within a figure rather than making them into one. It is not really consistent with the idea of semantic markup to put labels into image files as you seem to be doing. – cfr Nov 27 '15 at 04:41
  • GIMP will convert them to bitmap. If you resize them, you need to do it using something which keeps them in vector format. (Inkscape?) Do you really need them to be this huge? You are using 72pt font just for the labels? – cfr Nov 27 '15 at 04:44
  • @cfr Thank you for your advice! Yeah, I am putting labels into image files because I want to only include one picture in a latex template which maybe weird. I tried Inksacpe but the effect seems strange like the last pictures i just uploaded in the post. – sikisis Nov 27 '15 at 06:26
  • @cfr I have tried Inkscape but the output eps is much larger even though I reduce the size of the file by scaling the picture. I use output.eps 2.3MB in Inkscape to produce output-inkscape, output-inkscape.eps 12.3MB – sikisis Nov 27 '15 at 06:39
  • @cfr what a interesting question is that why PDF format is much smaller than this EPS format? – sikisis Nov 27 '15 at 06:43
  • The size of your three vector EPS files are 748KB, 852KB and 844KB. You must reduce the size of these files.... – Paul Gaborit Nov 27 '15 at 07:32
  • @PaulGaborit yeah, so how? like pstopdf? – sikisis Nov 27 '15 at 07:59
  • @PaulGaborit These works for pdf format which can reduce nealy 2/3 size of the files, but if I use the Tikz method of combining these three PDF together the output PDF seem the same because Pdflatex will alse translate EPS to PDF to insert into the final picture. – sikisis Nov 27 '15 at 08:08
  • @PaulGaborit I have use some program like ipe to reduce the size succeffuly but I did not clearly know why. – sikisis Nov 27 '15 at 08:29
  • To reduce the size of a vector EPS files, you have to (re-)produce it with less detail. – Paul Gaborit Nov 27 '15 at 08:41
  • @PaulGaborit however I can not further reduce the structure of the picture because I want these pictures to illustrate my idea. So whether the alternative method is that I have to bear the loss of resolution or finesse. – sikisis Nov 27 '15 at 09:45
  • 1
    From what I recall by memory, the tikz ball shadings are quite involved in terms of file size. I compiled your example without the external graphics and got 400 KB for the output.eps with your method. Using direct tikz to eps results in 225 KB. Now, if you would include small bitmap graphics instead of the ball shadings, you could save between 200 and 400 KB. And the result would render considerably faster as well, with controlable low loss of quality – Christian Feuersänger Nov 27 '15 at 13:08
  • I still don't understand why labelling them within the document and including them as separate files isn't an option. If you don't want to sacrifice anything in terms of the images themselves, that seems one straightforward way to avoid that. – cfr Nov 27 '15 at 14:14
  • @ChristianFeuersänger but if I include those ball as an external figures how can this be realized by commands like \foreach \x? Or just as I include EPS files using node to realize this? – sikisis Nov 28 '15 at 09:40
  • well, you would have one external graphics (eps) file for iron, one for electron, and one for each of the others. The foreach loop would merely choose the correct filename. – Christian Feuersänger Nov 28 '15 at 12:12
  • 1
    If we zoom your original eps files we can see that your blue line is not a line. You can probably reduce by factor of 10 this files if you generate them in a way to remove all this useless noise on the blue lines. – Kpym Nov 28 '15 at 17:37
  • @Kpym exactly these blue lines are streamlines which I use Matlab to get all those points. So I can not give a mathematical formula to represent all these lines and the multiple points is because I plot the same line several times to make them stronger to show the track. So you mean I can extrapolate them to make a line instead of points? – sikisis Nov 29 '15 at 08:40
  • 1
    @sikisis I have no idea how you generate this lines, but from the image we can see that you have too much useless information in the resulting image. If you can extrapolate, combined with Christian Feuersänger's suggestion to not use shaded balls, will probably reduce significantly the size. – Kpym Nov 29 '15 at 08:58

0 Answers0