[gimp] Issue #2275: rotate commands not actually applied to the image.



commit 8dcf258ffc039f2742496b350db37a1188cfac81
Author: Jehan <jehan girinstud io>
Date:   Sat Sep 19 18:55:54 2020 +0200

    Issue #2275: rotate commands not actually applied to the image.
    
    The rotation was actually applied but the image had an orientation
    metadata stored which is not visible in GIMP canvas (only checked at
    import).
    If GIMP had on-canvas viewing support of the orientation metadata, then
    it would make sense to keep it between import and export, but since it
    doesn't, we should assume that when someone asks to "Keep Original"
    during import, they are actually asking to drop the metadata (which
    actually can be wrong in various cases, in particular when you snap
    pictures of the ground or the sky, then sensors are lost anyway and
    regularly can't guess what orientation you wanted). This will make for
    less unexpected exports.

 libgimp/gimpimagemetadata-interactive.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/libgimp/gimpimagemetadata-interactive.c b/libgimp/gimpimagemetadata-interactive.c
index bff4667610..8cf10b4a5e 100644
--- a/libgimp/gimpimagemetadata-interactive.c
+++ b/libgimp/gimpimagemetadata-interactive.c
@@ -85,7 +85,25 @@ gimp_image_metadata_load_finish (GimpImage             *image,
         {
           if (! gimp_image_metadata_rotate_query (image, mime_type,
                                                   metadata))
-            flags &= ~GIMP_METADATA_LOAD_ORIENTATION;
+            {
+              /* If one explicitly asks not to rotate the image, just
+               * drop the "Orientation" metadata because that's how one
+               * wants to see the image.
+               *
+               * Note that there might be special cases where one wants
+               * to keep the pixel as-is while keeping rotation through
+               * metadata. But we don't have good enough metadata
+               * support for this yet, in particular we don't honor the
+               * orientation metadata when viewing the image. So this
+               * only ends up in unexpected exports with rotation
+               * because people forgot there was such metadata set and
+               * stored by GIMP. If maybe some day we have code to honor
+               * orientation while viewing an image, then we can do this
+               * a bit cleverer.
+               */
+              gexiv2_metadata_set_orientation (GEXIV2_METADATA (metadata),
+                                               GEXIV2_ORIENTATION_NORMAL);
+            }
         }
     }
 


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