---
title: "linux下安装libwebp"
author: "weistar"
date: "2013-12-18T17:48:58Z"
tags: []
categories: ["操作系统"]
slug: "linux-libwebp"
draft: true
lastmod: "2013-12-18T17:50:17Z"
id: 1991678
url: "https://weistar.iteye.com/blog/1991678"
---

**Preparing the platform**  
**Linux platform**

    Install the libjpeg and libpng packages, needed to convert between JPEG, PNG and WebP image formats. Packaged installation are dependent on the Linux distributions. As an example, Ubuntu distribution requires to run the following commands:

       **sudo apt-get install libjpeg62-dev**  
      **sudo apt-get install libpng12-dev**

    Complete the installation (see below).  
**Mac OS X platform 10.5 (Leopard) and 10.6 (Snow Leopard)**

    Follow the same steps outlined above except that you do not need to follow Step 4 to install libwebp.  
    Install the JPEG and PNG dependencies:

        **sudo port install libjpeg libpng**  
         
    Complete the installation (see below).

**Cygwin platform**

    Download setup.exe from the Cygwin web page.  
    Run setup.exe and proceed through the installation.  
    At the Select Packages screen, add to the pre-selected packages the following:  
        libjpeg-devel, libpng12-devel and libpng14-devel  
        gcc, make and automake (for building packages)  
    Complete the installation (see below).

**Building the WebP from source on Unix platforms**

    Download libwebp-0.1.2.tar.gz from the [downloads list](http://code.google.com/p/webp/downloads/list).  
    Untar or unzip the package. This creates a directory libwebp-0.1.2/:

          tar xvzf libwebp-0.1.2.tar.gz  
         
    Build WebP encoder cwebp and decoder dwebp:  
    Go to the libwebp/ directory and run the following commands:

          cd libwebp  
        ./autogen.sh  
        ./configure  
        make  
        sudo make install  
        备注:运行./autogen.sh报错,则先运行yum -y install automake libtool   

    This builds and installs the cwebp & dwebp command line tools, along with the libwebp libraries (dynamic and static).

    These tools are usually installed under /usr/local/bin/ by default. The local version are built under the examples/ directory.

    The library will usually be installed under the /usr/local/lib/ directory. To avoid run-time errors, make sure that your LD\_LIBRARY\_PATH environment variable includes this location. The C headers are typically installed under /usr/local/include/webp.