[luatex] handling resolution of jpg files
David Carlisle
d.p.carlisle at gmail.com
Thu Jan 12 14:51:46 CET 2017
The jpg file clip-1-2.jpg available from
https://github.com/latex3/graphics-def/tree/master/testfiles
has a resolution of 120 as reported by image magic identify
$ identify -verbose clip-1-2.jpg | head -8
Image: clip-1-2.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 243x214+0+0
Resolution: 120x120
Print size: 2.025x1.78333
Units: PixelsPerInch
pdftex picks this up and reports the natural image width as
146.34676pt=2.025in agreeing with image magic
luatex (at least how I am using it) doesn't pick up the resolution and
reports the width as 243.91125pt=243bp agreeing with the image geometry at
1bp per pixel.
To see the effect in latex compare
pdflatex t-clip-1.lvt
where the image is clipped to the circled 1 and 2, with
lualatex t-clip-1.lvt
where the initial image is larger so the clipping coordinates are off.
(You could also compare with xelatex, which does the wrong thing entirely,
but leave that for another list....)
To narrow it down, here is a tex primitive example without the latex
interfaces...
%%%%%%%%%%%%%%%%%
\ifx\saveimageresource\undefined\else
\let\pdfximage \saveimageresource
\let\pdflastximage \lastsavedimageresourceindex
\let\pdfrefximage \useimageresource
\fi
\setbox0\hbox{%
\immediate\pdfximage{clip-1-2.jpg}%
\pdfrefximage \pdflastximage}
\showthe\wd0
\box0
\end
%%%%%%%%%%%%%%%%%%
with pdftex I get
> 146.34676pt.
l.12 \showthe\wd0
and with luatex :
> 243.91125pt.
l.12 \showthe\wd0
As usual, a two part question
a) is it possible to make luatex act in a more pdftex compatible way here?
and
b) if not, am I missing something in the tex or lua interfaces that would
let me get hold of that 120 and so adjust the sizes in the image inclusion
macros?
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20170112/46baa5ee/attachment.html>
More information about the luatex
mailing list