Skip to content

Instantly share code, notes, and snippets.

@hakanai
Created September 14, 2018 00:02
Show Gist options
  • Save hakanai/128a45956e8199d4c502d84200d1b7f2 to your computer and use it in GitHub Desktop.
Save hakanai/128a45956e8199d4c502d84200d1b7f2 to your computer and use it in GitHub Desktop.
Some PNG related stuff
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 08 06 00 00 00 1f 15 c4 |................|
00000020 89 00 00 00 0d 49 44 41 54 78 da 63 98 f5 f9 7b |.....IDATx.c...{|
00000030 34 00 07 8f 02 e0 a7 82 a8 9a 00 00 00 00 49 45 |4.............IE|
00000040 4e 44 ae 42 60 82 |ND.B`.|
00000046
89 50 4e 47 0d 0a 1a 0a - magic
Chunk:
00 00 00 0d - size (13)
49 48 44 52 - type 'IHDR'
00 00 00 01 - width (1)
00 00 00 01 - height (1)
08 - bit depth (8)
06 - colour type (6, RGBA)
00 - compression method (0, DEFLATE)
00 - filter method (0, NONE)
00 - interlace method (0, NONE)
1f 15 c4 89 - CRC
Chunk:
00 00 00 0d - size (13)
49 44 41 54 - type (IDAT)
78 da 63 98 f5 f9 7b 34 00 07 8f 02 e0 - DEFLATE stream
a7 82 a8 9a - CRC
Chunk:
00 00 00 00 - size (0)
49 45 4e 44 - type (IEND)
(no payload)
ae 42 60 82 - CRC
DEFLATE stream:
78 - compression method (8, DEFLATE), flags (7, 32K LZ77 window)
da - flags 110 11010 fcheck (0b11010), dict (0), flevel (3, max compression)
63 98 f5 f9 7b 34 00 - compressed data
07 8f 02 e0 - ADLER32 checksum
Result of decompressing:
irb(main):006:0> x = ['78da6398f5f97b3400078f02e0'].pack('H*')
=> "x\xDAc\x98\xF5\xF9{4\x00\a\x8F\x02\xE0"
irb(main):007:0> Zlib::Inflate.inflate(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment