谷歌除去iTXt和文本塊,節省了大約1050個字節,並減少像素從32位/像素RGBA到索引4位/象素,節省了幾個字節:
$ pngcheck -v menu-mobile.png
File: menu-mobile.png (1265 bytes)
chunk IHDR at offset 0x0000c, length 13
16 x 32 image, 32-bit RGB+alpha, non-interlaced
chunk iTXt at offset 0x00025, length 1001, keyword: XML:com.adobe.xmp
uncompressed, no language tag
no translated keyword, 980 bytes of UTF-8 text
chunk tEXt at offset 0x0041a, length 25, keyword: Software
chunk IDAT at offset 0x0043f, length 158
zlib: deflated, 4K window, maximum compression
chunk IEND at offset 0x004e9, length 0
No errors detected in menu-mobile.png (5 chunks, 38.2% compression).
$ pngcheck -v menu-mobile-opt.png
File: menu-mobile_opt.png (216 bytes)
chunk IHDR at offset 0x0000c, length 13
16 x 32 image, 4-bit palette, non-interlaced
chunk PLTE at offset 0x00025, length 36: 12 palette entries
chunk tRNS at offset 0x00055, length 11: 11 transparency entries
chunk IDAT at offset 0x0006c, length 88
zlib: deflated, 512-byte window, default compression
chunk IEND at offset 0x000d0, length 0
No errors detected in menu-mobile_opt.png (5 chunks, 15.6% compression).
Pngcrush能做到通過減小像素爲16位/象素的灰色-α更好一點:
$ pngcrush -s -reduce -rem text menu-mobile.png menu-mobile-pc.png
$ pngcheck -v menu-mobile-pc.png
File: menu-mobile-pc.png (175 bytes)
chunk IHDR at offset 0x0000c, length 13
16 x 32 image, 16-bit grayscale+alpha, non-interlaced
chunk IDAT at offset 0x00025, length 118
zlib: deflated, 2K window, maximum compression
chunk IEND at offset 0x000a7, length 0
No errors detected in menu-mobile-pc.png (3 chunks, 82.9% compression).
在這種情況下,包含該壓縮的像素數據的IDAT組塊是比谷歌的結果更大的30個字節,但是這抵消通過Gray-alpha顏色類型不需要PLTE(3 6個字節的數據加上12個字節的塊開銷)和tRNS(11個字節的數據+ 12個字節開銷)塊。對於尺寸較大的圖像,這種折衷可能會有所不同。
你問Google嗎? – usr2564301
這是圖像嗎? – leonbloy