Page 1 of 1

EXtcreate-date and EXtmodify-date in PNG-files

Posted: 2009-08-11T23:32:24-07:00
by learnr
I am using the following Imagemagick script in a batch file to resize large png-images for web upload.

Code: Select all

FOR %%a in (*.png) DO "C:\Program Files\ImageMagick-6.5.3-Q8\convert.exe" %%a -resize 300x400^ +dither -colors 64  -quality 90 %%~dpna_small.png
Every now and then the source images are recreated, and the old images are overwritten with new ones with new create and modify dates. The images are overwritten even if they have not changed compared to the old images. After this the above script creates smaller file versions for web upload. The web uploader then uses MD5 binary hashes to check whether the smaller files have changed or not, and uploads the new files, if any.

The problem is that Imagemagick adds EXtcreate-date and EXtmodify-date (creation and modify date of the source file) to the end of the resized png-file, consequently the MD5 hashes of otherwise identical smaller files don't match and the uploader treats all the updated resized files as new files.

Is there a way to avoid this, i.e. to tell Imagemagick not to include information about the source file create and modify date in the resized file?

Re: EXtcreate-date and EXtmodify-date in PNG-files

Posted: 2009-08-13T13:53:36-07:00
by glennrp
These properties are added in constitute.c, ReadImage(). The following, or some variant of it, ought to work

Code: Select all

convert input.png +define date-create +define date-modify output.png
but it doesn't. The "+define key" method does not seem to work at all. Neither does

Code: Select all

convert input.png -define date-create=0 -define date-modify=0 output.png
The -strip option

Code: Select all

convert input.png -strip output.png
should also work but doesn't.
Glenn

Re: EXtcreate-date and EXtmodify-date in PNG-files

Posted: 2009-08-14T19:01:23-07:00
by magick
Try this:
  • convert logo: +set date:create logo.miff
That should remove the date:create property.

Re: EXtcreate-date and EXtmodify-date in PNG-files

Posted: 2009-08-31T16:12:17-07:00
by glennrp
+set did not work. If I start with a PNG that has dates, they get
overwritten with new ones, whether the "+set date:create" is present
or not:

Version: ImageMagick 6.5.5-5 2009-08-31 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Mon Aug 31 19:06:10 EDT 2009

rose.png:
date:create: 2009-08-13T15:43:41-04:00
date:modify: 2009-08-13T15:43:41-04:00

convert rose.png rose_nochange.miff
date:create: 2009-08-31T19:06:11-04:00
date:modify: 2009-08-31T19:06:11-04:00

convert rose.png +set date:create rose+set_create:date.miff:
date:create: 2009-08-31T19:06:13-04:00
date:modify: 2009-08-31T19:06:13-04:00

The same thing happens if I start with "rose:" instead of "rose.png".

Glenn

Re: EXtcreate-date and EXtmodify-date in PNG-files

Posted: 2009-08-31T18:04:46-07:00
by magick
The create:date property is created each time an image is read, however, it is not saved to the file if you use +set date:create. Try this:
-> convert rose.png +set date:create logo.miff
-> more logo.miff
id=ImageMagick version=1.0
class=DirectClass colors=0 matte=False
columns=70 rows=46 depth=8
colorspace=RGB
compression=Zip quality=0
resolution=72x72
page=70x46+0+0
date:modify={2009-08-31T20:59:50-04:00}
Notice how the date:modify property is not included in logo.miff. However, when you read logo.miff it is set once again.