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

实现原理 #2

Open
youfuyu opened this issue Nov 9, 2018 · 1 comment
Open

实现原理 #2

youfuyu opened this issue Nov 9, 2018 · 1 comment

Comments

@youfuyu
Copy link

youfuyu commented Nov 9, 2018

叶老师可不可以讲解一下实现原理啊!看不懂啊,官方文档翻了半天,完全无法理解 打击!!_| ̄|○

@inkydragon
Copy link

先大概看看,知道 PNG 的文件格式。

极简的 PNG 大概分为:

  • 签名 x1 b"\x89PNG\r\n\32\n"
  • 数据块
    1. IHDR(header chunk) x1
    2. IDAT(image data chunk) xN
    3. IEND(image trailer chunk) x1: b"IEND" + crc

基本数据块部分结尾都是 crc,函数名结尾带 c 的都是会把输入的数据加到 crc 的计算结果中。

能看懂这个 1x1 的 PNG 差不多就明白了。其他更大的无非是 IDAT 更大罢了。

细节就只能看 RFC 了。

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

2 participants