aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorDima Kogan2016-02-10 15:40:03 +1100
committerLars Ingebrigtsen2016-02-10 15:45:46 +1100
commit0f600496050bf435f55dc81056e06fcd45992dc8 (patch)
tree2714b9a5386cd5740cfe01220809dcc72e7a89f4 /src/image.c
parent7dd45b61b1cdcf0e5bd1620ab7e63a0b5095ffb8 (diff)
downloademacs-0f600496050bf435f55dc81056e06fcd45992dc8.tar.gz
emacs-0f600496050bf435f55dc81056e06fcd45992dc8.zip
Support integer image rotation and respect EXIF rotations
* src/image.c (imagemagick_load_image): Allow integer rotations in addition to floating point rotations (bug#22591). * 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.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/image.c b/src/image.c
index 144fe30a746..45abfc7af76 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8546,6 +8546,16 @@ imagemagick_load_image (struct frame *f, struct image *img,
8546 return 0; 8546 return 0;
8547 } 8547 }
8548 8548
8549 /* If no :rotation is explicitly specified, apply the automatic
8550 rotation from EXIF. */
8551 if (NILP (image_spec_value (img->spec, QCrotation, NULL)))
8552 if (MagickAutoOrientImage (image_wand) == MagickFalse)
8553 {
8554 image_error ("Error applying automatic orientation in image `%s'", img->spec);
8555 DestroyMagickWand (image_wand);
8556 return 0;
8557 }
8558
8549 if (ino < 0 || ino >= MagickGetNumberImages (image_wand)) 8559 if (ino < 0 || ino >= MagickGetNumberImages (image_wand))
8550 { 8560 {
8551 image_error ("Invalid image number `%s' in image `%s'", image, img->spec); 8561 image_error ("Invalid image number `%s' in image `%s'", image, img->spec);
@@ -8646,7 +8656,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
8646 image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP 8656 image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP
8647 (specified_bg). */ 8657 (specified_bg). */
8648 value = image_spec_value (img->spec, QCrotation, NULL); 8658 value = image_spec_value (img->spec, QCrotation, NULL);
8649 if (FLOATP (value)) 8659 if (FLOATP (value) || INTEGERP (value))
8650 { 8660 {
8651 rotation = extract_float (value); 8661 rotation = extract_float (value);
8652 status = MagickRotateImage (image_wand, bg_wand, rotation); 8662 status = MagickRotateImage (image_wand, bg_wand, rotation);