emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 0f60049 1/2: Support integer image rotation and r


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] emacs-25 0f60049 1/2: Support integer image rotation and respect EXIF rotations
Date: Wed, 10 Feb 2016 04:45:56 +0000

branch: emacs-25
commit 0f600496050bf435f55dc81056e06fcd45992dc8
Author: Dima Kogan <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    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.
---
 src/image.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/image.c b/src/image.c
index 144fe30..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);
@@ -8646,7 +8656,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
     image_spec_value (img->spec, QCbackground, NULL); if (!STRINGP
     (specified_bg).  */
   value = image_spec_value (img->spec, QCrotation, NULL);
-  if (FLOATP (value))
+  if (FLOATP (value) || INTEGERP (value))
     {
       rotation = extract_float (value);
       status = MagickRotateImage (image_wand, bg_wand, rotation);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]