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?

  • 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
  • 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
  • 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
  • 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 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.