26 lines
1.4 KiB
Markdown
26 lines
1.4 KiB
Markdown
![]() |
# The Brief Anatomy of a PNG image
|
||
|
|
||
|
```
|
||
|
The first 24 bytes:
|
||
|
(all numbers are uint32 big-endian)
|
||
|
|
||
|
PNG HEADER
|
||
|
╔════╗╔════╗╔════╗╔════╗╔════╗╔════╗╔════╗╔════╗
|
||
|
║ 89 ║║ 50 ║║ 4e ║║ 47 ║║ 0d ║║ 0a ║║ 1a ║║ 0a ║
|
||
|
╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝
|
||
|
0 1 2 3 4 5 6 7
|
||
|
|
||
|
CHUNK LENGTH CHUNK TYPE (IHDR)
|
||
|
╔════╗╔════╗╔════╗╔════╗╔════╗╔════╗╔════╗╔════╗
|
||
|
║ 00 ║║ 00 ║║ 00 ║║ 0d ║║ 49 ║║ 48 ║║ 44 ║║ 52 ║
|
||
|
╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝
|
||
|
8 9 10 11 12 13 14 15
|
||
|
|
||
|
WIDTH HEIGHT
|
||
|
╔════╗╔════╗╔════╗╔════╗╔════╗╔════╗╔════╗╔════╗
|
||
|
║ 00 ║║ 00 ║║ 02 ║║ 4c ║║ 00 ║║ 00 ║║ 03 ║║ 20 ║
|
||
|
╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝
|
||
|
16 17 18 19 20 21 22 23
|
||
|
|
||
|
... rest of the bytes in the png image ...
|
||
|
```
|