GraphicsMagick: HEIF: Retrieve image orientation from EXIF and s...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.4501.1687125231.9958.graphicsmagick-commit@lists.sourceforge.net>
changeset 1145694abfc7 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=1145694abfc7
summary: HEIF: Retrieve image orientation from EXIF and store in image

diffstat:

 ChangeLog          |   5 +++++
 coders/heif.c      |  23 +++++++++++++++++++++++
 www/Changelog.html |   7 +++++++
 3 files changed, 35 insertions(+), 0 deletions(-)

diffs (69 lines):

diff -r dd2a83c5d201 -r 1145694abfc7 ChangeLog
--- a/ChangeLog	Sun Jun 18 16:21:01 2023 -0500
+++ b/ChangeLog	Sun Jun 18 16:53:36 2023 -0500
@@ -1,3 +1,8 @@
+2023-06-18  Bob Friesenhahn  <[email protected]>
+
+	* coders/heif.c (ReadMetadata): Retrieve image orientation from
+	EXIF and store in image.
+
 2023-06-18  Przemysław Sobala  <[email protected]>
 
 	* coders/png.c (ReadOnePNGImage): Retrieve image orientation from
diff -r dd2a83c5d201 -r 1145694abfc7 coders/heif.c
--- a/coders/heif.c	Sun Jun 18 16:21:01 2023 -0500
+++ b/coders/heif.c	Sun Jun 18 16:53:36 2023 -0500
@@ -21,6 +21,7 @@
 */
 
 #include "magick/studio.h"
+#include "magick/attribute.h"
 #include "magick/blob.h"
 #include "magick/colormap.h"
 #include "magick/log.h"
@@ -267,6 +268,28 @@
               p[5]='\0';
 
               SetImageProfile(image,"EXIF",profile,profile_size+exif_pad+4);
+
+              /*
+                Retrieve image orientation from EXIF and store in
+                image.
+              */
+              {
+                const ImageAttribute
+                  *attribute;
+
+                attribute = GetImageAttribute(image,"EXIF:Orientation");
+                if ((attribute != (const ImageAttribute *) NULL) &&
+                    (attribute->value != (char *) NULL))
+                  {
+                    int
+                      orientation;
+
+                    orientation=MagickAtoI(attribute->value);
+                    if ((orientation > UndefinedOrientation) &&
+                        (orientation <= LeftBottomOrientation))
+                      image->orientation=(OrientationType) orientation;
+                  }
+              }
             }
           else
             {
diff -r dd2a83c5d201 -r 1145694abfc7 www/Changelog.html
--- a/www/Changelog.html	Sun Jun 18 16:21:01 2023 -0500
+++ b/www/Changelog.html	Sun Jun 18 16:53:36 2023 -0500
@@ -37,6 +37,13 @@
 </div>
 
 <div class="document">
+<p>2023-06-18  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
+<blockquote>
+<ul class="simple">
+<li><p>coders/heif.c (ReadMetadata): Retrieve image orientation from
+EXIF and store in image.</p></li>
+</ul>
+</blockquote>
 <p>2023-06-18  Przemysław Sobala  &lt;<a class="reference external" href="mailto:przemyslaw&#46;sobala&#37;&#52;&#48;gmail&#46;com">przemyslaw<span>&#46;</span>sobala<span>&#64;</span>gmail<span>&#46;</span>com</a>&gt;</p>
 <blockquote>
 <ul class="simple">
_______________________________________________
Graphicsmagick-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-commit
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.