[Tex/LaTex] Quality of embedded bitmaps using eps2pdf

epstopdfgraphics

I am compiling a single file using REVTEX 4.1. My image files are .eps files, and epstopdf is converting them on compilation. I load the following packages,

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{epstopdf}

and this all works fine, except for the quality of bitmaps embedded in the images is terrible. They appear to be heavily compressed. I suspect I need to set an option for epstopdf, but I don't know what. I tried

\epstopdfsetup{quality=100}

and got the error Package keyval Error: quality undefined. This;

http://ctan.mirrorcatalogs.com/macros/latex/contrib/oberdiek/epstopdf.pdf

has no mention of quality.

This is not something I can render using a vector based format. Also, eps is the preferred format for this particular journal. Can anyone help?

Edited to add: I use CorelDraw, and export an .eps. If I inspect the .eps by loading it back into CorelDraw, it looks fine. if I inspect the eps-converted-to.pdf in a similar way, it looks very bad. See below – left is before epstopdf, right is after.

graphs of different quality

Edited further to add:

The following link: http://www.latex-community.org/forum/viewtopic.php?f=5&t=3025 reccomends the following;

\DeclareGraphicsExtensions{.eps,.pdf}
\DeclareGraphicsRule{.eps}{pdf}{.pdf}{`epstopdf --gsopt="-dPDFSETTINGS=/prepress -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -sColorImageFilter=FlateEncode -sGrayImageFilter=FlateEncode -sCompressPages=false -dPreserveHalftoneInfo=true" #1}

This is not a solution I fully understand, and in any case, it doesn't work – epstopdf fails to run at all. The solution further down the page:

\epstopdfsetup{update,prepend,verbose,suffix=-generated} % use suffix because you don't want to accidentally overwrite a file that might have been a pdf source. The epstopdf package manual has more on that.

\DeclareGraphicsExtensions{.eps,.pdf}
\epstopdfDeclareGraphicsRule{.eps}{pdf}{.pdf}{epstopdf --gsopt="-dPDFSETTINGS=/prepress -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -sColorImageFilter=FlateEncode -sGrayImageFilter=FlateEncode -sCompressPages=false -dPreserveHalftoneInfo=true" #1 --outfile=\OutputFile}

sends the compilation into an unbreakable loop of some kind. I'm using TeXnicCenter, if that makes any difference.

Best Answer

Ok, I cracked it. The link I cite in my question actually explains this, once I took the trouble to read it properly.

The following is added to the preamble after \include{epstopdf};

\epstopdfsetup{update,prepend,verbose,suffix=-generated} % use suffix because you don't want to accidentally overwrite a file that might have been a pdf source. The epstopdf package manual has more on that.
\DeclareGraphicsExtensions{.eps,.pdf}
\epstopdfDeclareGraphicsRule{.eps}{pdf}{.pdf}{epstopdf --gsopt="-dPDFSETTINGS=/prepress -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -sColorImageFilter=FlateEncode -sGrayImageFilter=FlateEncode -sCompressPages=false -dPreserveHalftoneInfo=true" #1 --outfile=\OutputFile}

and the following MUST be added to the output profile/command line when running latex.

"--enable-write18"

Hope that is of use to someone else.

Related Question