mozilla install

鄂慈
2023-12-01

-----------------------------------------------------------------------------------------------------------

扩展知识:

 

webp简介

WebP (发音”weppy”),由google 2010年发布。是一种同时提供了有损压缩与无损压缩的图片文件格式,派生自图像编码格式VP8 。 是由Google购买On2 Technologies后发展出来的格式,以BSD授权条款发布。

目前PC浏览器只有Chrome兼容webp,但移动设备都有兼容webp的方案。

 

webp优缺点

相比JPEG,这种格式可以把图片大小减少40%,而且前整个互联网的流量中有65%为图片。这意味如果Google让这种格式得到普及的话,你浏览网页的速度将大幅提升。

美中不足的是,WebP格式图像的编码时间“比JPEG格式图像长8倍”。

 

案例 

淘宝App大图jpg和webpp格式对比:

jpg图片:87.6k      http://gw2.alicdn.com/bao/uploaded/i2/T1sIPTFB8bXXXXXXXX_!!0-item_pic.jpg

webp图片:17.6k     http://gw2.alicdn.com/bao/uploaded/i2/T1sIPTFB8bXXXXXXXX_!!0-item_pic.jpg_640x640q90.jpg_.webp

 

参考资料 

Google developers webp官方文档 <https://developers.google.com/speed/webp/>

wikipedia-webp <http://en.wikipedia.org/wiki/WebP>  

Google推出新的图片格式WebP,挑战JPEG,让互联网更快 <http://www.36kr.com/p/4963.html>

谷歌WebP图像格式评测:压缩率显著提升 <http://www.csdn.net/article/2010-10-11/280355>

webp 浏览器兼容大全 <http://caniuse.com/webp/>

支持Android4.0以下webp的使用 <http://blog.csdn.net/jiwangkailai02/article/details/17015451>

 





About a month ago Mozilla announced their 'mozjpeg' project with the aim of improving lossless jpeg compression and making the web a faster place. Forked from libjpeg-turbo, mozjpeg is more concerned with reducing filesize than doing it quickly. It uses the same compression process written in a perl script by Loren Merritt called jpegcrush and claims to be able to reduce jpeg size by 10% on average.

So, it sounds pretty good and you want to save some bandwidth and give mozjpeg a go. With a lack of an auto-install option using a repository like APT you will need to build it from source which sounds complicated but is actually pretty easy as I show.


Full build instructions can be found in the build instructions file in the github repo. These are very comprehensive and cover all "Un*x Platforms (including Cygwin and OS X)". This guide aims to simplify the process by giving step by step guide for building on Ubuntu 12.04 (and should be portable for other versions of Ubuntu and probably other flavours of Linux as well with a some minor changes).

Download Source

First you need to download the source.

You can either use a release version which should be stable and ready for production use from the list of release archives and download the latest version and extract it (v1.0.1 is the latest version at time of writing):

wget https://github.com/mozilla/mozjpeg/archive/v1.0.1.tar.gz
tar -xvf v1.0.1.tar.gz

Alternatively, if you want the latest cutting edge version you can clone the github repository directly:

sudo apt-get install git
git clone https://github.com/mozilla/mozjpeg.git

Install Requirements

Building mozjpeg requires the following programs to be installed:

  • autoconf 2.56 or later
  • automake 1.7 or later
  • libtool 1.4 or later
  • NASM 0.98 or later
  • make

You can go ahead and install them like so:

sudo apt-get install autoconf automake libtool nasm make

Building

Once the source has been downloaded and extracted, navigate to the extracted contents directory. Next running autoreconf will to build the configure file. Then create a build directory inside the source and navigate to it. Once in the build directory, runconfigure which will generate the Makefile which is used to install the final program using make install and is run as sudoso it has permission to put the installation in /opt.

cd mozjpeg-1.0.1
autoreconf -fiv
mkdir build && cd build
sh ../configure
sudo make install 

Usage

Following the above instructions will install mozjpeg in /opt/libmozjpeg and it can be used by calling jpegtran in the bin directory:

/opt/libmozjpeg/bin/jpegtran -copy none image.jpg > compressed.jpg

However, I find it easier to add the command to my local path so it can be accessed anywhere. Also, as it shares it's namings with libjpeg-turbo, renaming it to something like mozjpeg makes it more convenient to use and remember, especially if you already have libjpeg-turbo installed:

sudo ln -s /opt/libmozjpeg/bin/jpegtran /usr/local/bin/mozjpeg

After adding this link you can use mozjpeg from anywhere easily and conveniently:

mozjpeg -copy none image.jpg > compressed.jpg

And there you have it, mozjpeg installed on your system ready to save you bandwidth and speed up your website!

 类似资料:

相关阅读

相关文章

相关问答