Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imagemagick parameters for avoiding tIME chunk incorrect #27105

Closed
BenLubar opened this issue Sep 24, 2023 · 1 comment · Fixed by #27111
Closed

imagemagick parameters for avoiding tIME chunk incorrect #27105

BenLubar opened this issue Sep 24, 2023 · 1 comment · Fixed by #27111
Labels
bug Something isn't working status/to triage This issue needs to be triaged

Comments

@BenLubar
Copy link
Contributor

Steps to reproduce the problem

  1. Upload an image.

Expected behaviour

There should not be a modification time encoded into the file.

Actual behaviour

There is a modification time encoded into the file.

Detailed description

image

Mastodon instance

No response

Mastodon version

No response

Technical details

This should be a simple find-and-replace to fix.

@BenLubar BenLubar added bug Something isn't working status/to triage This issue needs to be triaged labels Sep 24, 2023
@unascribed
Copy link
Contributor

unascribed commented Sep 24, 2023

+set date:timestamp is also needed to remove the final timestamp tEXt chunk. These strings match the keywords used in the tEXt chunks, so this looks like a transcription mistake, but there's no harm in keeping the "broken" ones too in case they do work on older versions of ImageMagick — or other file formats such as JPEG or WebP.

This is (and has been, for an unknown length of time) breaking PNG dedupe on Jortage; my thread on this is what called Ben Lubar's attention to it and resulted in them opening the issue.

Hexdump of a bad PNG file created by Mastodon
00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52  |.PNG........IHDR|
00000010  00 00 00 01 00 00 00 01  01 00 00 00 00 37 6e f9  |.............7n.|
00000020  24 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  02 62 4b 47 44 00 01 dd  8a 13 a4 00 00 00 07 74  |.bKGD..........t|
00000070  49 4d 45 07 e7 09 18 13  0b 1b 28 d9 91 95 00 00  |IME.......(.....|
00000080  00 0a 49 44 41 54 08 d7  63 68 00 00 00 82 00 81  |..IDAT..ch......|
00000090  dd 43 6a f4 00 00 00 25  74 45 58 74 64 61 74 65  |.Cj....%tEXtdate|
000000a0  3a 63 72 65 61 74 65 00  32 30 32 33 2d 30 39 2d  |:create.2023-09-|
000000b0  32 34 54 31 39 3a 31 31  3a 32 37 2b 30 30 3a 30  |24T19:11:27+00:0|
000000c0  30 58 fe ec bc 00 00 00  25 74 45 58 74 64 61 74  |0X......%tEXtdat|
000000d0  65 3a 6d 6f 64 69 66 79  00 32 30 32 33 2d 30 39  |e:modify.2023-09|
000000e0  2d 32 34 54 31 39 3a 31  31 3a 32 37 2b 30 30 3a  |-24T19:11:27+00:|
000000f0  30 30 29 a3 54 00 00 00  00 28 74 45 58 74 64 61  |00).T....(tEXtda|
00000100  74 65 3a 74 69 6d 65 73  74 61 6d 70 00 32 30 32  |te:timestamp.202|
00000110  33 2d 30 39 2d 32 34 54  31 39 3a 31 31 3a 31 31  |3-09-24T19:11:11|
00000120  2b 30 30 3a 30 30 93 e9  47 06 00 00 00 00 49 45  |+00:00..G.....IE|
00000130  4e 44 ae 42 60 82                                 |ND.B`.|
00000136
Hexdump of a file created with the OP's "fixed" command
00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52  |.PNG........IHDR|
00000010  00 00 00 01 00 00 00 01  01 00 00 00 00 37 6e f9  |.............7n.|
00000020  24 00 00 00 20 63 48 52  4d 00 00 7a 26 00 00 80  |$... cHRM..z&...|
00000030  84 00 00 fa 00 00 00 80  e8 00 00 75 30 00 00 ea  |...........u0...|
00000040  60 00 00 3a 98 00 00 17  70 9c ba 51 3c 00 00 00  |`..:....p..Q<...|
00000050  02 62 4b 47 44 00 01 dd  8a 13 a4 00 00 00 0a 49  |.bKGD..........I|
00000060  44 41 54 08 d7 63 68 00  00 00 82 00 81 dd 43 6a  |DAT..ch.......Cj|
00000070  f4 00 00 00 28 74 45 58  74 64 61 74 65 3a 74 69  |....(tEXtdate:ti|
00000080  6d 65 73 74 61 6d 70 00  32 30 32 33 2d 30 39 2d  |mestamp.2023-09-|
00000090  32 34 54 31 39 3a 31 32  3a 34 35 2b 30 30 3a 30  |24T19:12:45+00:0|
000000a0  30 c4 71 d6 72 00 00 00  00 49 45 4e 44 ae 42 60  |0.q.r....IEND.B`|
000000b0  82                                                |.|
000000b1

Note that while the tIME chunk is indeed now gone, there is still a tEXt chunk of type date:timestamp containing the same data. Adding +set date:timestamp creates a file that is truly lacking all time information.

Hexdump of a file created via convert xc: +profile '!icc,*' +set date:modify +set date:create +set date:timestamp test.png
00000000  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52  |.PNG........IHDR|
00000010  00 00 00 01 00 00 00 01  01 00 00 00 00 37 6e f9  |.............7n.|
00000020  24 00 00 00 20 63 48 52  4d 00 00 7a 26 00 00 80  |$... cHRM..z&...|
00000030  84 00 00 fa 00 00 00 80  e8 00 00 75 30 00 00 ea  |...........u0...|
00000040  60 00 00 3a 98 00 00 17  70 9c ba 51 3c 00 00 00  |`..:....p..Q<...|
00000050  02 62 4b 47 44 00 01 dd  8a 13 a4 00 00 00 0a 49  |.bKGD..........I|
00000060  44 41 54 08 d7 63 68 00  00 00 82 00 81 dd 43 6a  |DAT..ch.......Cj|
00000070  f4 00 00 00 00 49 45 4e  44 ae 42 60 82           |.....IEND.B`.|
0000007d

I'm adding a workaround for this to poolmgr, but it would be nice to see this fixed in upstream — these timestamps are unnecessary metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status/to triage This issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants