How can I generate a consistent file

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
cdhm
Posts: 2
Joined: 2016-06-23T19:52:18-07:00
Authentication code: 1151

How can I generate a consistent file

Post by cdhm »

Hi

I am using convert to generate a splash screen as part of a build process. The build process should generate the same binary file each time if nothing has changed.

Unfortunately the splash screen generation is messing this up because the file changes every time we run convert.

I found the trick of removing the date properties, but the date/time in the header always change:

charles@charles-Aspire-VN7-791G://opt/hj/linux-AVX3-SDUcom$ hexdump -C xx.png | more
00000000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 |.PNG........IHDR|
00000010 00 00 01 e0 00 00 01 10 10 06 00 00 00 38 d6 7b |.............8.{|
00000020 cf 00 00 00 04 67 41 4d 41 00 00 b1 8f 0b fc 61 |.....gAMA......a|
00000030 05 00 00 00 20 63 48 52 4d 00 00 7a 26 00 00 80 |.... cHRM..z&...|
00000040 84 00 00 fa 00 00 00 80 e8 00 00 75 30 00 00 ea |...........u0...|
00000050 60 00 00 3a 98 00 00 17 70 9c ba 51 3c 00 00 00 |`..:....p..Q<...|
00000060 06 62 4b 47 44 ff ff ff ff ff ff 09 58 f7 dc 00 |.bKGD.......X...|
00000070 00 00 07 74 49 4d 45 07 e0 06 18 02 24 1a cf 73 |...tIME.....$..s| <----------------- here
00000080 f7 40 00 00 80 00 49 44 41 54 78 da ec 9d 67 9c |.@....IDATx...g.| <--------------- here

Is there any way to get convert to always generate a file header with a stable date/time?


The script command line is:

convert -size 480x272 canvas:white \
-font Bookman-DemiItalic -pointsize 78 -draw "text 10,60 $1" \
-channel RGBA -blur 0x6 -fill blue -stroke darkblue -draw "text 20,55 $1" \
-pointsize 24 -stroke green -strokewidth 1 -fill green -font Courier -weight thin \
-blur 0x0 -antialias \
-draw "text 10,100 'SVN Revision: $SVN_VERSION'" \
-stroke red -fill red -draw "circle 140,190 160,190" \
-stroke green -fill green -draw "circle 200,190 220,190" \
-stroke blue -fill blue -draw "circle 260,190 280,190" \
-stroke black -fill black -draw "circle 320,190 340,190" \
+set date:create +set date:modify \
$2

Thanks

Charles
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How can I generate a consistent file

Post by snibgo »

Try "-define png:include-chunk=none".
snibgo's IM pages: im.snibgo.com
cdhm
Posts: 2
Joined: 2016-06-23T19:52:18-07:00
Authentication code: 1151

Re: How can I generate a consistent file

Post by cdhm »

Thanks for the quick response. That did the job!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How can I generate a consistent file

Post by snibgo »

Good stuff. That's a sledge-hammer, and you might want to exclude only whichever chunk(s) cause the problem. I don't know which chunks those are.
snibgo's IM pages: im.snibgo.com
Post Reply