A New Format for Lossless and Lossy Image Compression
Lossless webp images are 26% smaller in size compared to PNG. Lossy webp images are 25-34% smaller in size compared to JPEG. This package reads and writes webp images into a 3 (rgb) or 4 (rgba) channel bitmap array using conventions from the 'jpeg' and 'png' packages.
# Convert to webp
library(png)
img <- readPNG(system.file("img", "Rlogo.png", package="png"))
write_webp(img, "rlogo.webp")
browseURL("rlogo.webp")
rm(img)
# Convert from webp
library(jpeg)
img <- read_webp("rlogo.webp")
writeJPEG(img, "rlogo.jpeg")
browseURL("rlogo.jpeg")
Binary packages for OS-X or Windows can be installed directly from CRAN:
install.packages("webp")
Installation from source on Linux or OSX requires libwebp
. On Debian or Ubuntu install libwebp-dev:
sudo apt-get install -y libwebp-dev
On Fedora we need libwebp-devel:
sudo yum install libwebp-devel
````
On __CentOS / RHEL__ we install [libwebp-devel](https://src.fedoraproject.org/rpms/libwebp) via EPEL:
sudo yum install epel-release sudo yum install libwebp-devel
On __OS-X__ use [webp](https://github.com/Homebrew/homebrew-core/blob/master/Formula/webp.rb) from Homebrew:
brew install webp ```
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.