tags:

views:

801

answers:

1

I am looking for the best way to convert my JPEG files into EPS. I have to convert my image files to EPS to insert into my LaTeX files. Note that I am using dvipdfm to compile my LaTeX file into PDF and I am not using pdflatex.

The problem is that the actual size of the image changes under the conversion to EPS. Therefore, I have to use the "scale" option of the "includegraphics" command in LaTeX to get the image scale to its actual size. I have tried Gimp, Jpeg2ps and ImageMagick Convert to convert my JPEG files into EPS files. However, each of these converters produces an EPS file whose actual size is different from the actual size of the original JPEG file.

I'd like to know if anyone knows of a way to convert JPEG files to EPS files which preserves the original dimensions of the image. Such a dimension-preserving converter would relieve us from scaling the image in the LaTeX file manually.

My LaTeX file (include-image.tex) is the following:

\documentclass{article}
\usepackage[dvipdfm]{graphicx}
\begin{document}
\begin{figure}
\includegraphics{image.eps}
\end{figure}
\end{document}

And, I use the following Makefile to produce the pdf:

include-image.pdf: include-image.dvi
        dvipdfm include-image.dvi
include-image.dvi: include-image.tex
        latex include-image.tex
+4  A: 

JPEG is a raster format with a fixed resolution, EPS is a vector format with no resolution.

http://www.logodesignworks.com/blog/vector-graphics-and-raster-graphics-difference

A raster graphics don't have physical dimensions relative to print media, the application that renders them out uses a conversion ratio, Dots-Per-Inch (DPI), to scale the graphic. If you have a 2000x2000 pixel JPEG and you print it out at 400 DPI it will be 5x5 inches, if you print it at 800 DPI it will be 2.5x2.5 inches.

In the jpeg2ps program you mention there is a -r switch to specify the DPI of the input JPEG that will calculate the dimensions of the EPS file by dividing the pixel dimensions of the JPEG by the DPI value to get the inch dimensions of the EPS file.

CptSkippy
Thanks for you reply. Passing the correct dpi value to the -r switch solved my problem.I opened my JPEG image in Gimp and selected the menu item "Print Size..." from the "Image" menu. The "Print Size" dialog lists the width and height of the image in inches and the X resolution and Y resolution in pixels/in. In my case, the X resolution and Y resolution were the same and I used it as the argument to the "-r" option of Jpeg2ps. When I set the dpi for conversion to EPS, the image in the final PDF and the original image are of the same sizes.
reprogrammer