go The Brief Anatomy of a PNG image

2026-08-30 浏览 (1)

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 ...

你可能感兴趣的文章

go The Brief Anatomy of a PNG image

go main

  • 所属分类: 后端技术
  • 本文标签: golang
  • 版权声明: 本文链接 https://seaxiang.com/blog/2DFfN1TC