GraphicsMagick: New TGA attributes "comment", "creator", "softwa...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.2870.1665565206.1350.graphicsmagick-commit@lists.sourceforge.net>
changeset 5b13d1021e84 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=5b13d1021e84
summary: New TGA attributes "comment", "creator", "software", "TGA:file.JobName"

diffstat:

 ChangeLog    |   5 +++++
 coders/dpx.c |   4 ++--
 coders/tga.c |  17 ++++++++++++++++-
 3 files changed, 23 insertions(+), 3 deletions(-)

diffs (72 lines):

diff -r 95fcb786ed45 -r 5b13d1021e84 ChangeLog
--- a/ChangeLog	Mon Oct 10 17:27:45 2022 -0500
+++ b/ChangeLog	Wed Oct 12 10:53:44 2022 +0200
@@ -1,3 +1,8 @@
+2022-10-12    Fojtik Jaroslav  <[email protected]>
+
+        * coders/tga.c New attributes "comment", "creator", "software", "TGA:file.JobName" 
+        * coders/gpx.c Renamed attribute "DPX:file.creator" to "creator"
+
 2022-10-10    Fojtik Jaroslav  <[email protected]>
 
         * coders/tga.c TGA developper area is read.
diff -r 95fcb786ed45 -r 5b13d1021e84 coders/dpx.c
--- a/coders/dpx.c	Mon Oct 10 17:27:45 2022 -0500
+++ b/coders/dpx.c	Wed Oct 12 10:53:44 2022 +0200
@@ -1690,12 +1690,12 @@
   StringToAttribute(image,"comment",dpx_file_info.project_name);
   StringToAttribute(image,"copyright",dpx_file_info.copyright);
   StringToAttribute(image,"document",dpx_file_info.image_filename);
+  StringToAttribute(image,"creator",dpx_file_info.creator);
   /* StringToAttribute(image,"timestamp",dpx_file_info.creation_datetime); */
 
   StringToAttribute(image,"DPX:file.version",dpx_file_info.header_format_version);
   StringToAttribute(image,"DPX:file.filename",dpx_file_info.image_filename);
   StringToAttribute(image,"DPX:file.creation.datetime",dpx_file_info.creation_datetime);
-  StringToAttribute(image,"DPX:file.creator",dpx_file_info.creator);
   StringToAttribute(image,"DPX:file.project.name",dpx_file_info.project_name);
   StringToAttribute(image,"DPX:file.copyright",dpx_file_info.copyright);
   U32ToAttribute(image,"DPX:file.encryption.key",dpx_file_info.encryption_key);
@@ -4239,7 +4239,7 @@
   GenerateDPXTimeStamp(dpx_file_info.creation_datetime,
                        sizeof(dpx_file_info.creation_datetime));
 #if 0 /* To enable use of original file creator. */
-  AttributeToString(image_info,image,"DPX:file.creator",dpx_file_info.creator);
+  AttributeToString(image_info,image,"creator",dpx_file_info.creator);
   if (dpx_file_info.creator[0] == '\0')
 #endif
     (void) strlcpy(dpx_file_info.creator,GetMagickVersion((unsigned long *) NULL),
diff -r 95fcb786ed45 -r 5b13d1021e84 coders/tga.c
--- a/coders/tga.c	Mon Oct 10 17:27:45 2022 -0500
+++ b/coders/tga.c	Wed Oct 12 10:53:44 2022 +0200
@@ -140,7 +140,9 @@
     magick_uint32_t ColorCorrectionOffset;
     magick_uint32_t PostageStampOffset;
     magick_uint32_t ScanLineOffset;
-    unsigned char AttributesType;
+    unsigned char AttributesType;	/* 0: no Alpha; 1 undefined useless data in the Alpha; 
+					   2: undefined data in the Alpha might be retained; 
+                                           3 useful Alpha channel; 4: pre-multiplied Alpha */
     /* Scan Line Table - Field 25 (Variable) */
     /* Postage Stamp Image - Field 26 (Variable) */
     /* Color Correction Table - Field 27 (2K Bytes) */
@@ -446,6 +448,19 @@
           tga_devel.AttributesType = ReadBlobByte(image);
 
           if(image->logging) LogTGADevel(&tga_devel);
+          if(status == MagickTrue)	/* TGA devel is valid */
+          {
+            if(tga_devel.Comments[0] != 0)
+                SetImageAttribute(image, "comment", tga_devel.Comments)
+            if(tga_devel.Author[0] != 0)
+                SetImageAttribute(image, "creator", tga_devel.Author)
+            if(tga_devel.SoftwareID[0] != 0)
+                SetImageAttribute(image, "software", tga_devel.SoftwareID)
+            if(tga_devel.JobNameID[0] != 0)
+                SetImageAttribute(image, "TGA:file.JobName", tga_devel.JobNameID)
+          }
+          else
+            tga_devel.ExtensionSize = 0;	/* Imvalidate TGA developper area. */
         }
       }
     }
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.