Page 1 of 1

ImageMagick sets date:create incorrectly

Posted: 2014-10-25T14:44:38-07:00
by AGWA
ImageMagick currently sets the "date:create" property of images to the st_ctime field of the source image's stat struct. However, per the stat(2) man page, st_ctime contains not the creation time of a file, but the change time, which is the time that a file's inode information (permissions, link count, etc.) was last changed.

Consequentially, images produced by ImageMagick contain misleading information. It also means that if you rename or change the permissions
of a file, images converted from that file are no longer byte-for-byte identical with images previously produced from that file, even though the file didn't actually change.

Unfortunately, Unix doesn't provide any way to get a file's creation time. I therefore propose that ImageMagick simply stop setting the "date:create" property. The following patch accomplishes this. Could it be applied to ImageMagick? Cheers!

Code: Select all

Index: MagickCore/constitute.c
===================================================================
--- MagickCore/constitute.c	(revision 16820)
+++ MagickCore/constitute.c	(working copy)
@@ -721,9 +721,6 @@
     (void) FormatMagickTime(GetBlobProperties(next)->st_mtime,MaxTextExtent,
       timestamp);
     (void) SetImageProperty(next,"date:modify",timestamp,exception);
-    (void) FormatMagickTime(GetBlobProperties(next)->st_ctime,MaxTextExtent,
-      timestamp);
-    (void) SetImageProperty(next,"date:create",timestamp,exception);
     option=GetImageOption(image_info,"delay");
     if (option != (const char *) NULL)
       {