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

Metadata order changing #174

Closed
Arcnor opened this issue Jun 12, 2019 · 0 comments
Closed

Metadata order changing #174

Arcnor opened this issue Jun 12, 2019 · 0 comments

Comments

@Arcnor
Copy link

Arcnor commented Jun 12, 2019

Hi,

I'm trying to have a pipeline that processes PNGs so when they're saved again, if the image data doesn't change, they don't get flagged as a new file by Git (for example).

I was going to use oxipng for this, but it seems it changes the order of chunks for some reason.

I created an image of a single pixel and ran oxipng as oxipng -o 4 -i 0 --strip All pixel.png. The first time I got this result:

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 09 70 48 59  73 00 00 2e 23 00 00 2e  |.....pHYs...#...|
00000040  23 01 78 a5 3f 76 00 00  00 07 74 49 4d 45 07 e3  |#.x.?v....tIME..|
00000050  06 0c 09 04 07 6c 4b e2  bc 00 00 00 0a 49 44 41  |.....lK......IDA|
00000060  54 78 da 63 68 00 00 00  82 00 81 da 45 08 3b 00  |Tx.ch.......E.;.|
00000070  00 00 00 49 45 4e 44 ae  42 60 82                 |...IEND.B`.|
0000007b

And the second time (against the already optimized 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 09 70 48 59  73 00 00 2e 23 00 00 2e  |$....pHYs...#...|
00000030  23 01 78 a5 3f 76 00 00  00 04 67 41 4d 41 00 00  |#.x.?v....gAMA..|
00000040  b1 8f 0b fc 61 05 00 00  00 07 74 49 4d 45 07 e3  |....a.....tIME..|
00000050  06 0c 09 04 07 6c 4b e2  bc 00 00 00 0a 49 44 41  |.....lK......IDA|
00000060  54 78 da 63 68 00 00 00  82 00 81 da 45 08 3b 00  |Tx.ch.......E.;.|
00000070  00 00 00 49 45 4e 44 ae  42 60 82                 |...IEND.B`.|
0000007b

As you can see, the pHYs chunk is moving around, and if I run a third time, other blocks will randomly move.

Will it be possible for metadata chunks to be always in the same order, either all the time or with some parameter?

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant