[luatex] handling resolution of jpg files

Hans Hagen pragma at wxs.nl
Sat Jan 14 12:44:45 CET 2017

On 1/14/2017 12:03 AM, David Carlisle wrote:

> latex (far more than context or plain) has an expectation for working
> over multiple
> engines. Documented (and documentable) differences are understandable,
> luatex
> isn't expected to be fully compatible with pdftex. But this is a
> difference in internal
> data in a binary file where luatex is taking a different choice to
> pdftex (and image
> magic at least  as far as I can see) It is going to be very hard to
> document to end users
> when this might occur or what to do if it does.

fwiw ... Traditionally graphics are unrelated to engines and when we had 
reasons to support different backend (dvi+special flavours as well as 
pdf) context always had a clear separation between front- and backend 
via some intermediate common interface. (In fact this was quite a 
handicap for graphics as one had to deal with scale based vs size based 
vs .. backend support.) As in dvi mode we had no means to know 
properties of graphics we always used either parsing preambles or 
external programs to identify these properties.

Anyway, graphics and especially ones with errors in them always will be 
a problem and no engine can handle them all. Recently we added 
orientation support in luatex which is also tricky. There has been 
issues with 1 pixel resolutions (eventually we decided that messing up 
internals to catch one bad graphic is a no-go). Color in images 
(included in pdf) can be an issue too (but we deal with that in 
different ways). Messed up external graphics and fonts will always be an 
issue I fear. And one can always code around it (e.g. using some flag) 
but another one (or the reverse case) will pop up. The nice thing about 
tex is that one can always say: rubish in - rubish out.

We can cook up some flag (0=current, 1=exif jfif swapped, 2=use 
specified resolution) but in the end the user still has to make a choice 
in case of troubles (of course the macro package can decide for some 


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

More information about the luatex mailing list