[NTG-pdftex] pdftex in dvi mode and reading JPEG files

Eric.Brunet at lps.ens.fr Eric.Brunet at lps.ens.fr
Wed Oct 25 13:21:40 CEST 2006


I have always found annoying that pdftex and latex don't accept the same
formats of image files (jpg,png,pdf versus eps). It doesn't really make
sense, as including a JPEG into a postscript file is a very easy operation
since postscript 2.0.

It annoys me so much that I am trying to change that. So far, I have
written a patch for dvips (the version in the texlive) which makes dvips
able to read and embed JPEG files into a postscript. The next step is
adding LaTeX support. As it stands, one can use my patched dvips with a
LaTeX file looking like
	\includegraphics[bb=0 0 width height]{bla.jpg}
where width and height are the dimension (in bp) of bla.jpg.

It works, but it is not very ergonomic. It would be much nicer if LaTeX
were able to read by itself the size of the picture. It should be very
easy to do, as in modern TeX distributions, latex is simply pdfetex
working in dvi mode, and pdfetex knows how to read jpg files.

I tried to print the size of my picture with the following LaTeX code


but it doesn't work in dvi mode, as the executable complains that I dared
to use pdfximage in dvi mode, and exits.

It seems to me, however, that the previous code should be allowed in dvi
mode, as nothing weird for a dvi file arrives on the output list. In
other words, I suggest that \pdfximage should be allowed a priori in
dvi mode, and that an error should only occur if the program actually
tries to write the image on the output file. In that way, it would become
possible to patch the graphics package in order to include JPEG files in
dvi mode and produce a valid postscript file with my patched dvips.

Another possibility, of course, would be to introduce one or two new
primitives in pdfetex which would give the size of a picture file.

What do you think ? Is either of my suggestions acceptable ?

My patch is available on http://tudia.nerim.net/tex/


	Éric Brunet

More information about the ntg-pdftex mailing list