The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: A New Format for Lossless and Lossy Image Compression
Version: 1.3.0
Description: 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.
License: MIT + file LICENSE
URL: https://jeroen.r-universe.dev/webp
BugReports: https://github.com/jeroen/webp/issues
SystemRequirements: libwebp
Encoding: UTF-8
Suggests: jpeg, png
RoxygenNote: 7.1.1
Language: en-GB
NeedsCompilation: yes
Packaged: 2024-12-16 14:17:03 UTC; jeroen
Author: Jeroen Ooms ORCID iD [aut, cre]
Maintainer: Jeroen Ooms <jeroenooms@gmail.com>
Repository: CRAN
Date/Publication: 2024-12-16 15:10:02 UTC

Webp image format

Description

Read and write webp images into a bitmap array. The bitmap array uses the same conventions as the png and jpeg package.

Usage

read_webp(source, numeric = TRUE)

write_webp(image, target = NULL, quality = 80)

Arguments

source

raw vector or path to webp file

numeric

convert the image to 0-1 real numbers to be compatible with images from the jpeg or png package.

image

array of 3 dimensions (width * height * channel) with real numbers between 0 and 1.

target

path to a file or NULL to return the image as a raw vector

quality

value between 0 and 100 for lossy compression, or NA for lossless compression.

Examples

# Convert to webp
library(png)
img <- readPNG(system.file("img", "Rlogo.png", package="png"))
out <- file.path(tempdir(), "rlogo.webp")
write_webp(img, out)
# browseURL(out)

# Convert from webp
library(jpeg)
img <- read_webp(out)
jpeg <- file.path(tempdir(), "rlogo.jpeg")
writeJPEG(img, jpeg)
# browseURL(jpeg)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.