2015-04-08 94 views
1

來自:http://gtmetrix.com/reports/hosting.site.dev.nexwrx.com/OUsrZOCY _include/IMG /菜單mobile.png可以節省1.0KiB(82%還原)批優化PNG的谷歌的PageSpeed

事我試圖

pngcrush _include/img/menu-mobile.png menu-mobile.png 

最佳pngcrush方法= 6(WS 12 FM 5 ZL 9 ZS 0)= 215 爲menu-mobile.pn (1.38%臨界塊減少) (0.24%文件大小減小)

當我嘗試optipng -o7 _include/img/menu-mobile.png _include/IMG /菜單mobile.png已經優化

pngquant --quality=75-80 _include/img/logo 

pngpngquant:mempool.c:40:mempool_create:斷言`((uintptr_t的)(* mptr +(* mptr) - >使用) & 15UL)'失敗。 中止

pngquant似乎只是一切失敗(Ubuntu的14.04)2.01版

任何想法,我怎麼能在巴紐得到減少82%,爲谷歌的狀態?

+2

你問Google嗎? – usr2564301

+0

這是圖像嗎? – leonbloy

回答

3

谷歌除去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個字節開銷)塊。對於尺寸較大的圖像,這種折衷可能會有所不同。

+0

工作就像一個魅力:)謝謝 – jmituzas