图片优化

  1. 先解释几个名词吧

    1.1) Transparency (透明度)

    1.2) Animation (动画)

    1.3) Lossy (有损)

    1.4) Horizontal scanning (水平扫描)

    1.5) Progressive (渐进)

    1.6) Interlacing (交错)

  2. 如何优化

    2.1) Crushing PNGs

    pngcrush -rem alla -brute -reduce src.png dest.png
    

    2.2) Stripping JPEG metadata

    jpegtran -copy none -optimize src.jpg > dest.jpg
    

    2.3) Converting single-image (nonanimated) GIFs to PNGs

    # Tool: ImageMagick
    convert source.gif destination.png
    identify -format %m my.gif # determine whether the GIF file contains an animation
    

    2.4) Optimizing GIF animations

    # Tool: Gifsicle
    gifsicle -O2 src.gif > dest.gif
    

这篇文章: 有用 无用