ImageMagick
“分块”
Wikipedia PNG Specification
,每个块都有一个类型,例如
IHDR
(标题),
PLTE
(调色板),
IDAT
(图像数据),
IEND
(文件结束标记)以及关键的长度(以字节为单位)。
IEND公司
ImageMagick
GD公司
或
枕头
正在阅读并让
ImageMagick
转换文件。然后将累积的(PNG)字符串归零,并开始读取下一个文件。
chrome-cast | demultiplex
哪里
demultiplex
可能是:
while not error
clear accumulated string of PNG data
done = false
while not done
read chunk type and length of chunk
read whole chunk and append to accumulated string of PNG data
if chunk = IEND
pass accumulated PNG string to ImageMagick to make BMP
done = true
endif
end
end
“理解”
所有区块类型或其内容-只需识别区块长度和
IEND公司
请注意,您可能喜欢跑步
pngcheck
或
pngsplit
here
. 事实上
PNG分裂
无论如何,我可以做你想做的事。
下面是一个示例
PNG检查
实际操作:
pngcheck -v file.png
File: file.png (462308 bytes)
chunk IHDR at offset 0x0000c, length 13
800 x 468 image, 32-bit RGB+alpha, non-interlaced
chunk gAMA at offset 0x00025, length 4: 0.45455
chunk cHRM at offset 0x00035, length 32
White x = 0.3127 y = 0.329, Red x = 0.64 y = 0.33
Green x = 0.3 y = 0.6, Blue x = 0.15 y = 0.06
chunk bKGD at offset 0x00061, length 6
red = 0x00ff, green = 0x00ff, blue = 0x00ff
chunk pHYs at offset 0x00073, length 9: 3779x3779 pixels/meter (96 dpi)
chunk tIME at offset 0x00088, length 7: 2 Oct 2017 21:34:26 UTC
chunk IDAT at offset 0x0009b, length 32768
zlib: deflated, 32K window, maximum compression
chunk IDAT at offset 0x080a7, length 32768
chunk IDAT at offset 0x100b3, length 32768
chunk IDAT at offset 0x180bf, length 32768
chunk IDAT at offset 0x200cb, length 32768
chunk IDAT at offset 0x280d7, length 32768
chunk IDAT at offset 0x300e3, length 32768
chunk IDAT at offset 0x380ef, length 32768
chunk IDAT at offset 0x400fb, length 32768
chunk IDAT at offset 0x48107, length 32768
chunk IDAT at offset 0x50113, length 32768
chunk IDAT at offset 0x5811f, length 32768
chunk IDAT at offset 0x6012b, length 32768
chunk IDAT at offset 0x68137, length 32768
chunk IDAT at offset 0x70143, length 3115
chunk tEXt at offset 0x70d7a, length 37, keyword: date:create
chunk tEXt at offset 0x70dab, length 37, keyword: date:modify
chunk IEND at offset 0x70ddc, length 0
No errors detected in file.png (24 chunks, 69.1% compression).
我在Perl中完成了PNG分块的基本版本,以获得另一个答案,请快速查看
here