[tex-live] Question about importing images into TeX/LaTeX documents...

Karl Berry karl@freefriends.org
Thu, 2 Jan 2003 18:31:26 -0500


    I'm quite a newbie in the TeX/LaTeX arena...
    but i find it very exciting!

Nice to hear :).

    I would like to know if there is a way to keep
    the image just in PNG or PS format and be able to
    generate either PDF output or PS output.

It is possible to convert between all of these, in fact there are
several programs which do so.

To go from png to ps, you can run pngtopnm | pnmtops.
To go from png to pdf, you can add | ps2pdf to the pipeline.
To go from ps to png, you can run pstopnm | pnmtopng.

ps2pdf is part of Ghostscript (www.ghostscript.com).
The others are part of the netpbm tools (netpbm.sourceforge.net).

There is also a program called convert, part of imagemagick
(www.imagemagick.org), which can at least handle ps/pnm, not sure about
the others.

All of these are included in most GNU/Linux distributions, to my
knowledge (e.g., red hat 8.0).  On other platforms, you'll have to
install them.

With some images, I've had better luck converting into jpeg with cjpeg
and then using various jpgto* programs to convert back out.

Hope this helps,
karl