If you don't want that the image is distorted, why do you set keepaspectratio to false?
–
Ulrike FischerAug 21 '12 at 18:28

Because aspect ratio refers to width/height. The aspect ratio of the clipped image will be smaller since I reduced the width.
–
boboboboAug 21 '12 at 18:39

1

Clipping should work, but @Ulrike is right, keepaspectratio is not needed here and should not be used. Also note that the px unit is a pdftex extension and uses a fixed (but configurable) density which might not be correct for this particular JPG. Sometimes the images metadata are not fully correct, leading to a wrong display with LaTeX.
–
Martin Scharrer♦Aug 21 '12 at 18:50

Well imho the key should either be not necessary or have the value true. But why do you use the key at all? Do you set the width and height key globally?
–
Ulrike FischerAug 21 '12 at 18:54

1 Answer
1

dvips.def: ok for PostScript images, but clipping is not supported for bitmap images.

xetex.def: Clipping is not supported at all.

dvipdfm.def: The image is not trimmed, but distorted in the final area.

dvipdfmx.def: The whole image is put in the final area without distortion, but
empty space is put above the small image.

A remark to keepaspectratio: It has a meaning only if both the width and
height are specified. Thus the setting and values of keepaspectratio does not matter here.

There is a solution for dvips.def, dvipdfm.def and dvipdfmx.def if pdfTeX is used as TeX compiler (for DVI mode). Package bmpsize fixes as side effect the
defective drivers. And the package improves the bitmap inclusion making separate bounding box files obsolete. The driver xetex.def cannot be fixed this way, because XeTeX misses
primitives from pdfTeX (especially \pdffiledump), needed by bmpsize.

Is there any way these issues can be fixed in the drivers themselves? For example, it's possible to do clipping for XeTeX not at the engine level but using the xdvipdfmx driver. [This also reminds me that I guess I should write some LaTeX3 driver code for picture importing :-)]
–
Joseph Wright♦Aug 21 '12 at 21:22

Clipping can be done via page operators or form xobjects. Someone has written clipping support for xetex.def and posted it to comp.text.tex, but I do not know the current state. The drivers seems not to be actively maintained.
–
Heiko OberdiekAug 21 '12 at 21:58

'Someone' in the context of xetex.def would be me, with some prodding from Martin Scharrer :-) I was under the impression that you were in charge of the driver code, hence asking. Obviously I was mistaken.
–
Joseph Wright♦Aug 21 '12 at 22:00

1

I am maintaining pdftex.def. Could you contact the maintainers of xetex.def?
–
Heiko OberdiekAug 21 '12 at 22:26