<span id='7m7lr'></span>
<i id='7m7lr'></i>
  • <tr id='7m7lr'><strong id='7m7lr'></strong><small id='7m7lr'></small><button id='7m7lr'></button><li id='7m7lr'><noscript id='7m7lr'><big id='7m7lr'></big><dt id='7m7lr'></dt></noscript></li></tr><ol id='7m7lr'><table id='7m7lr'><blockquote id='7m7lr'><tbody id='7m7lr'></tbody></blockquote></table></ol><u id='7m7lr'></u><kbd id='7m7lr'><kbd id='7m7lr'></kbd></kbd>
  • <fieldset id='7m7lr'></fieldset>
  • <ins id='7m7lr'></ins>

      1. <dl id='7m7lr'></dl>

          <code id='7m7lr'><strong id='7m7lr'></strong></code>
          <i id='7m7lr'><div id='7m7lr'><ins id='7m7lr'></ins></div></i><acronym id='7m7lr'><em id='7m7lr'></em><td id='7m7lr'><div id='7m7lr'></div></td></acronym><address id='7m7lr'><big id='7m7lr'><big id='7m7lr'></big><legend id='7m7lr'></legend></big></address>

            Linux下压缩和优化jpg与png图片的方法

            • 时间:
            • 浏览:17
            • 来源:124软件资讯网

                jpegotim压缩jpg图片

                安装jpegotim

                若是你有epel yum源  ,使用如下下令即可

                代码如下:

                # yum install jpegoptim

                压缩图片下令

                代码如下:

                # jpegoptim ttlsa.jpg

                ttlsa.jpg 1425x823 24bit N JFIF [OK] 1074449 --> 853514 bytes (20.56%), optimized.

                可以看到ttlsa.jpg自动被压缩了20.56% 。

                再压缩一次

                代码如下:

                # jpegoptim ttlsa.jpg

                ttlsa.jpg 1425x823 24bit N JFIF [OK] 853514 --> 853514 bytes (0.00%), skipped.

                图片已经被压缩过了  ,以是提醒跳过  ,不需要在被压缩  。

                提供一个批量压缩的剧本

                代码如下:

                for i in /data/site/image.ttlsa.com/images/*.jpg; do jpegoptim $i; done

                pngcrush优化PNG图片

                项目地址:http://pmt.sourceforge.net/pngcrush/

                代码如下:

                # wget http://downloads.sourceforge.net/project/pmt/pngcrush/1.7.88/pngcrush-1.7.88.tar.gz

                # tar -xzvf pngcrush-1.7.88.tar.gz

                # cd pngcrush-1.7.88

                # make

                # cp pngcrush /usr/bin

                pngcrush使用语法

                代码如下:

                usage: pngcrush [options except for -e -d] infile.png outfile.png

                pngcrush -e ext [other options] file.png ...

                pngcrush -d dir/ [other options] file.png ...

                pngcrush -ow [other options] file.png [tempfile.png]

                pngcrush -n -v file.png ...

                options:

                -bail (bail out of trial when size exceeds best size found

                -bit_depth depth (deprecated)

                -blacken (zero samples underlying fully-transparent pixels)

                -brute (use brute-force: try 148 different methods)

                ........更多内容请自己看资助......

                pngcrush简朴下令

                代码如下:

                pngcrush -brute -e "myimage_compressed.png" myimage.png

                .........省略.....

                Best pngcrush method = 123 (ws 15 fm 4 zl 9 zs 1) = 124820

                for output to ttlsattlsa_new.png

                (1.63% critical chunk reduction)

                (1.63% filesize reduction)

                CPU time decoding 1.560, encoding 7.640, other 0.030, total 9.230 sec.

                批量优化PNG图片

                代码如下:

                pngcrush -brute -d "/data/site/image.ttlsa.com/images" *.png