From b070fb5f8b4e9cb84e15a8a7970e4dcb25696d1c Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sun, 7 Feb 2016 14:43:24 -0800 Subject: [PATCH 2/2] imagemagick respects the orientation EXIF tag * src/image.c (imagemagick_load_image): images that have an orientation given in EXIF and have no explicit :rotation tag are now pre-rotated. All information such as width/height is reported for the rotated image --- src/image.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/image.c b/src/image.c index 133d696..45abfc7 100644 --- a/src/image.c +++ b/src/image.c @@ -8546,6 +8546,16 @@ imagemagick_load_image (struct frame *f, struct image *img, return 0; } + /* If no :rotation is explicitly specified, apply the automatic + rotation from EXIF. */ + if (NILP (image_spec_value (img->spec, QCrotation, NULL))) + if (MagickAutoOrientImage (image_wand) == MagickFalse) + { + image_error ("Error applying automatic orientation in image `%s'", img->spec); + DestroyMagickWand (image_wand); + return 0; + } + if (ino < 0 || ino >= MagickGetNumberImages (image_wand)) { image_error ("Invalid image number `%s' in image `%s'", image, img->spec); -- 2.1.4