format - What do these bytes do? -


this hexdump of black 1x1 png made in gimp , exported minimal information:

89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 01 00 00 00 01 08 02 00 00 00 90 77 53 de 00 00 00 0c 49 44 41 54 08 d7 63 60 60 60 00 00 00 04 00 01 27 34 27 0a 00 00 00 00 49 45 4e 44 ae 42 60 82 

now after reading the specification quite sure of them mean, except bytes 30-34 between ihdr , idat chunk: 90 77 53 de

can enlighten me?

those numbers crc checksum previous chunk. see in the official specification: 5 datastream structure general overview, , in particular 5.3 chunk layout.

a crc calculated for, , appended each separate chunk:

a four-byte crc (cyclic redundancy code) calculated on preceding bytes in chunk, including chunk type field , chunk data fields, not including length field. crc can used check corruption of data. crc present, chunks containing no data.

here 1x1 pixel image, annotated byte byte. right after data of each of chunks ihdr, idat, , iend crc preceding data.

file: test.png 89 50 4e 47 0d 0a 1a 0a   header 0x89 "png" cr lf ^z lf checks out okay =========== 00 00 00 0d 49 48 44 52 00 00 00 01 00 00 00 01 08 02 00 00 00 90 77 53 de   block:  "ihdr", 13 bytes [49484452]   width:              1   height:             1   bit depth:          8   color type:         2 = color   (bits per pixel: 8)   (bytes per pixel: 3)   compression method: 0   filter method:      0   interlace method:   0 (none)   crc: 907753de =========== 00 00 00 0c 49 44 41 54 08 d7 63 60 60 60 00 00 00 04 00 01 27 34 27 0a   block:  "idat", 12 bytes [49444154]   expanded result: 4 (as expected)   (row   0 filter:0)   decompresses   00 00 00 00   crc: 2734270a =========== 00 00 00 00 49 45 4e 44 ae 42 60 82   block:  "iend", 0 bytes [49454e44]   crc: ae426082 

the idat data decompresses 4 0's: first 1 row filter (0, meaning 'none') , next 3 bytes red, green, blue values 1 single pixel.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -