[luatex] handling resolution of jpg files

David Carlisle d.p.carlisle at gmail.com
Sat Jan 14 00:03:54 CET 2017


Luigi,

> So in luatex we have a width of 243pixels at 72dpi, hence 243.91125pt.

> On the other side pdftex takes the other way, so we have 243pixels at
120dpi, hence  146.34676pt.

I think that's an unfortunate choice and ask you to at least give a
customisation
option to take the other choice.

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.

Even if compatibility with pdftex isn't a priority, taking a different
choice to common
image tools such as image magic convert will cause surprises.

as far as I can see most tools that can handle both formats (pdftex,
browsers, etc)
will treat these two images as the same size

https://github.com/latex3/graphics-def/blob/master/testfiles/clip-1-2.jpg
https://github.com/latex3/graphics-def/blob/master/testfiles/clip-1-2.png

in latex at least the common idiom is to use \includegraphics{clip-1-2}
with no extension and leave it to the system to load whichever version it
can handle
(eg jpg here and .eps for latex/dvips etc. If the different versions (as
converted by "convert")
come out as different size then this is going to be a recurring cause of
support queries.

Given that you are anyway poking in the jpeg internals would it at least be
possible
to give a warning that the image has multiple specified resolutions. If you
could
give a warning that gave the number 120 the user (or latex on behalf of the
user
if the warning was trappable) could issue some variant on \pdfvariable
imageresolution
and force the resolution to be taken into account, or \usejfif data or
whatever else
makes sense as an interface? That way there would at least be a
documentable way
of getting the expected size here.


Sorry if this sounds ungrateful:-) Thanks for the fix so far I can confirm
(after some problems building luatex) that for other images without this
resolution ambiguity, luatex now gives the same size as pdftex.



David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20170113/78ff5129/attachment.html>


More information about the luatex mailing list