tl;dr version: The metadata in the Koala file is inconclusive, as the Exif header exists, but doesn't specify the resolution. To solve the problem use some tool to either add the resolution to the Exif data or remove the Exif data completely.
First some technicalities on how metadata of (modern) jpg images is stored (I'm not an expert on this, so the following might not be entirely correct): There are two formats for metadata, called JFIF (JPEG file interchange format) and EXIF (Exchangeable image file format). The first was created to solve some deficiencies with the original JPEG file format (JIF), the second one to add metadate from cameras. Both can be present in the same file (and usually are). Both have a field to set the resolution of the image. Note that the original JPEG file format (JIF) had no way of storing the resolution.
The Koala.jpg
image that comes with Windows includes both kinds of metadata (though most Exif fields are unused). However it only has the resoltution stored in the JFIF metadata, while the Exif resolution field is empty. It seems that pdflatex
and xelatex
behave differently in this setting.
pdflatex
either always ignors the Exif data or falls back to the JFIF data when the Exif data it is incomplete. So it successfully reads the resolution information from the file and applies it. (I guess Taco's solution attempts only set the default resolution and hence where overridden by the successfully read resolution from the file.)
xelatex
sees the Exif metadata and thus tries to read from it. But since there is no resolution information in it, it falls back to its default resolution of 72ppi. It seems that when some Exif data is present, xelatex
ignores the entire JFIF block (I don't know whether this is a feature or a bug). When the Exif data is completely removed (e.g. via exiv2 rm Koala.jpg
), then it reads the JFIF metadata and correctly applies the resolution stored there.
resolution
is undefined inxetex
". What isresolution
? Which values are you getting forpdftex
? How big are the differences? They simply might be some rounding issues (bp
topt
) conversion. Please don't keep asking "doesn't work" questions without details! BTW,scale=1
is useless but simply adds some overhead. Is it part of the problem? If so, state it explicitly, if not it doesn't has anything to do in a MWE.identify -verbose
and see whetherResolution
is set.