[XeTeX] Scaling graphics

George N. White III gnwiii at gmail.com
Mon May 3 12:30:25 CEST 2010


On Sat, May 1, 2010 at 12:01 PM, Michiel Kamermans
<pomax at nihongoresources.com> wrote:

> Ulrike,
>
>> Well most of the graphics on my pc have either no dpi entry or 72,
>> but I found one with 300dpi and this too is larger (x4) when used
>> with xelatex. (it is not a graphic I can share so we can't test if
>> it works for you too).
>
> Odd... I did a minmal example with the jpg that Jose linked to, and it
> indeed becomes way too large. However, when I compare it to one of the
> graphics I use in my book
> (http://grammar.nihongoresources.com/lib/exe/fetch.php?cache=&media=gyousho.jpg
> <http://grammar.nihongoresources.com/lib/exe/fetch.php?cache=&media=gyousho.jpg>),
> running xelatex on the following code makes it look exactly as big as the
> image indicates it should be...
>
> \documentclass{article}
> \usepackage{xltxtra}
> \usepackage{graphicx}
> \begin{document}
> \section{Figura\textunderscore 3-1.JPG}
> \includegraphics{Figura_3-1.JPG}
> \section{gyousho.jpg}
> \includegraphics{gyousho.jpg}
> \end{document}
>
> There's two differences between the two, one in the amount of EXIF data, the
> other in the presence of a "thumbnail" encoding in my image which comes with
> its own 72dpi... now I'm wondering which image graphicsx actually picks up!
> If it picks up the 72dpi thumbnail instead of the 300dpi actual image,
> that'd be a pretty severe bug in graphicx.

You should be able to see the difference using a pdf viewer and setting
a high magnification.

There are free tools included, e.g., with Imagemagick, to display the
metadata in various image formats.

> I'll see if I can "rig" an image so that the thumbnail looks nothing like
> the actual image, and see what the resulting pdf looks like.
>
>> I checked the image properties with irfanview and it shows 601x601
>> dpi and resolution unit "inch".
>>
>
> I used IrfanView too, intrestingly enough I get different values now that
> I'm back home and have downloaded the jpg to this machine instead... Still
> leaves an interesting mystery.

The "units" may be affected by the locale as well as settings specific to
IrfanView.   XeTeX introduces some complexity as both xetex itself and
also the dvi to pdf converter need to use the image metadata and/or make
some assumptions.

In general, the safest route when you are creating pdf's is to convert all
figures and images to pdf first.  In this way you can check that the conversion
is done properly in each case and choose tools that work best for each of the
formats used in a document.   The size and complexity of XeTeX would be
greatly increased if it contained all the image processing capabilities needed
for every type of figure.   XeTeX development is done by a very few people,
but if you draw on  3rd party image processing tools you benefit from a much
larger pool of users and developers.

-- 
George N. White III <aa056 at chebucto.ns.ca>
Head of St. Margarets Bay, Nova Scotia


More information about the XeTeX mailing list