jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.78k stars 3.39k forks source link

EXIF orientation is ignored #10311

Open xi opened 1 month ago

xi commented 1 month ago

To reproduce this issue, I used the images from https://github.com/recurser/exif-orientation-examples/ (see exact markdown below). In the generated pdf, the images do not have the correct orientation. I get the same result when converting to odt or docx.

Tested with both pandoc 3.1.11.1 (debian trixie) and pandoc 3.5 (docker)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Landscape_0.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Landscape_1.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Landscape_2.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Landscape_3.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Landscape_4.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Landscape_5.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Landscape_6.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Landscape_7.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Landscape_8.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Portrait_0.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Portrait_1.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Portrait_2.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Portrait_3.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Portrait_4.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Portrait_5.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Portrait_6.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Portrait_7.jpg)

![](https://raw.githubusercontent.com/recurser/exif-orientation-examples/refs/heads/master/Portrait_8.jpg)
silby commented 2 weeks ago

I did a little bit of research.

JuicyPixels can tell you the EXIF orientation for an image, if present in the metadata.

EXIF orientation takes on the following values (ref):

1 = Horizontal (normal)
2 = Mirror horizontal
3 = Rotate 180
4 = Mirror vertical
5 = Mirror horizontal and rotate 270 CW
6 = Rotate 90 CW
7 = Mirror horizontal and rotate 90 CW
8 = Rotate 270 CW

T.P.ImageSize could use this information to swap width and height for quarter-turned images (orientations 5-8).

Writers that embed image data into documents where EXIF orientation is not automatically respected can apply transforms when outputting the image, e.g.:

silby commented 6 days ago

Messing around in libreoffice, Exif entirely to the side, there doesn't actually seem to be a way to rotate an anchored-as-character (i.e., inline) image a quarter turn and have it appear both uncropped and at the correct aspect ratio. Apache OpenOffice (does anyone use that?) doesn't even support rotated images. Neat.