From: Axel Kohlmeyer (
Date: Sat Feb 05 2005 - 04:58:35 CST

>>> "MM" == Marc Q Ma <> writes:

MM> Greetings!

hi marc,

some remarks addressing some of your statements.

MM> I would like to share with everyone a recent finding about using gimp
MM> software (on Unix) to convert the tga, jpg ... images to eps files.
MM> Here is how you do it: launch gimp, open the file you have (jpeg),
MM> right click on the image and choose to save as .eps file (let system
MM> determine type automatically).

VMD by default starts the 'display' utility of the ImageMagick
package which also allows to save images directly in eps format
with autodetection of the format by the file name.

you can change this viewer (for some cases) by setting the environment
variable VMDIMAGEVIEWER, e.g. to 'gimp %s' to have VMD lauch gimp
instead. you can also change this manually by editing the command
line in the render menu. which is just shell script code with '%s'
standing for the temporary filename.

MM> We all love the high quality images that VMD can generate. However, it
MM> is a pin in the neck to try to use these images in latex files. I have
MM> tried to convert the targa (.tga) files to jpeg file using xv, then
MM> convert the jpeg files to eps using jpeg2ps. The quality of the
MM> converted images drop significantly. When you try to use these images
MM> in latex using \includegraphix, the outcome is very disappointing.

please do _NEVER_ convert pixel images with sharp contrasts, like those
produced by VMD, temporarily to JPEG format. this will kill much of the
image quality and produce lots of artefacts wherever there are hard
contrasts. the second issue, that you have to be very careful with,
is rescaling and dpi values. your screen has usually 75 to 100dpi but
high quality printers easily have over 1000dpi. so for high quality
printouts, you should create 'oversize' images and make sure you
preserve the number of pixels as far as possible. it also helps, if
you adapt the original image size to the intended output. for instance,
for 'normal' color printouts on a color laser printer 300dpi is a
good compromize between image quality, size and printing speed.
so for an image, that should be 5x5 inches in size, i render the
image with 1500x1500 pixels, thus i'll have no rescalings at all
and the maximum image quality (i.e. no moiree artefacts, etc.).
this also works well if the printer has a 600dpi resolution, but
for a printer with, say 328 dpi resolution, i have to better render
a 1640x1640 image and make sure that the output flagged with 328dpi
as well (this is _extremely_ important if you are using gimp, which
will encode _and_ preserve a dpi value in formats that support it).

there are many ways to convert .tga files directly to eps.
using gimp is one option, but also xv (just use postscript, for
large images you have to make sure to have activated the 'Normal Size'
button for maximum quality), the 'convert' utility from the ImageMagick
is probably the easiest non-gui way, using the netpbm tools the command
line would be, e.g. 'tgatoppm snap.tga| pnmtops > snap.eps'

MM> The eps file converted using gimp is very very good. Try it and you
MM> will enjoy it!

MM> Or, maybe someday the latex developers and standards committee will
MM> come up with a set of macros to directly handle jpeg, targa .... files
MM> without loss of quality. That day may come ... Before that there is
MM> gimp ...

please read the documentation on the graphicx package. there _are_
macros and options where you can define almost _any_ conversion you like
(e.g. use gzip to uncompress gzipped .ps or .eps files on-the-fly). but
in my experience the best way to deal with images in latex is in fact to
use pdflatex and then use PNG images (conversion will be lossless from
TGA). pdf supports PNG internally and IIRC the images are stored in full
internally, even if you use scaling in the latex code.

best regards,

MM> Or, maybe someday the VMD folks will support directly render images in
MM> eps format... Do not know about their agenda ... Before eps is directly
MM> supported by VMD, there is always gimp ...

MM> Cheers!

MM> Marc
MM> ---------------------------------------------------------------------
MM> Marc Q. Ma, Ph.D. | 973-642-4497
MM> Department of Computer Science | 973-596-5777 (fax)
MM> New Jersey Institute of Technology |
MM> University Heights, Newark, NJ 07102 |
MM> ---------------------------------------------------------------------

Axel Kohlmeyer       e-mail:
Lehrstuhl fuer Theoretische Chemie          Phone: ++49 (0)234/32-26673
Ruhr-Universitaet Bochum - NC 03/53         Fax:   ++49 (0)234/32-14045
D-44780 Bochum
If you make something idiot-proof, the universe creates a better idiot.