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

Heiko Oberdiek oberdiek at uni-freiburg.de
Wed Oct 25 17:07:50 CEST 2006


On Wed, Oct 25, 2006 at 04:27:12PM +0200, Eric.Brunet at lps.ens.fr wrote:

> > Heiko Oberdiek Wrote:
> > > 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
> > 
> > But there are lots of different drivers: dvips, dvipsone, VTeX, ...
> > The main problem is a missing standard for graphics inclusion and other
> > things that extends the DVI format specification.
> 
> I agree, doing things perfectly is a huge task. But, hey, one needs to
> start somewhere. Having dvips working would already be something...
> 
> > There is no need to patch, dvips already can convert and embed
> > files on the fly. (See the last argument of \DeclareGraphicsRule,
> > check dvips (configuration) options for enabling the feature,
> > if it is disabled.)
> 
> Well, solutions such as
> 	\DeclareGraphicsRule{.jpg}{eps}{}{`jpeg2ps -r0 #1}
> are not really satisfactory: even if your correspondants use the same
> driver as you do, they need to have an extra program installed,

Otherwise you would need uptodate programs, that is also a problem,
see below.

> and they need
> to have a very unsecure option enabled. (Do you really like the idea that
> ``latex foobar && dvips foobar -o'' might erase all your files if foobar
> was written with bad intentions ?)

The insecure option can be avoided by a small dvi filter program.
It analyzes the \special texts, performs secure conversions
and replaces the conversion commands in the \special text
by the converted output file.

> The most important problem is that if you want to be compatible with what
> pdflatex does wehn including a jpeg file without specifying its size, you
> need to invoke ``jpeg2ps -r0'' for jpg files with a resolution in the
> JFIF segment, and ``jpeg2ps -r72'' for jpg files without a resolution, so
> you cannot have everything working correctly with a simple
> \DeclareGraphicsRule invocation. That is very annoying ! Is there a
> better programm than jpeg2ps out there ?

You can inspect the resolution using bmpsize.

> Of course, my patch simply does the same thing as jpeg2ps from within
> dvips, but without the senseless rescaling. The only difference is that
> it is more robust (no problem fiddling with the options of jpeg2ps), and
> no need for the unsecure shell-escapes.

There are lots of image formats (n):
  BMP, GIF, JPEG, MSP, PAM, PCX, PNG, PNM, SGI, TGA, TIFF,
  WMF, XPM, ...
And there are lots of dvi drivers (m):
  dvips, dvipsone, dvipdfm, pdfTeX, VTeX, ...

Thus the work is O(n \times m), I would prefer a
solution with O(n + m).

> > No need for this, look at package bmpsize!
> > 
> That is great. I didn't know that wonderfull package. Unfortunately, I
> cannot test it right now because my pdftex is too old, but I'll remember
> it exists.

It uses \pdffiledump, available since pdfTeX 1.30.

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>
-- 


More information about the ntg-pdftex mailing list