WebP libraries
Open-source libraries that decode and encode WebP files. Almost all of them use Google’s libwebp underneath; pure implementations exist for C# (ImageSharp), Java (TwelveMonkeys, decode only), Go (x/image/webp, decode only) and Rust (image-webp, lossless encode only). Check animation support if you need it: many libraries read only the first frame.
| Language | Library | Read | Write | Notes |
|---|---|---|---|---|
| C/C++ | libwebp | yes | yes | reference implementation, lossy, lossless, animation |
| C# | ImageSharp | yes | yes | pure managed code, animation |
| C# | SkiaSharp | yes | yes | Skia wrapper, bundles libwebp |
| C# | Magick.NET | yes | yes | ImageMagick for .NET, animation |
| Java | webp-imageio | yes | yes | ImageIO plugin, JNI to libwebp |
| Java | TwelveMonkeys | yes | no | pure Java ImageIO plugin |
| Go | x/image/webp | yes | no | pure Go, Go team’s extended library |
| Go | gen2brain/webp | yes | yes | libwebp without cgo, animation |
| Python | Pillow | yes | yes | lossy, lossless, animation, metadata |
| Python | OpenCV | yes | yes | images as NumPy arrays |
| Ruby | ruby-vips | yes | yes | fast, low memory, animation |
| Rust | image-webp | yes | lossless | pure Rust, used by the image crate |
| Rust | webp | yes | yes | safe bindings to libwebp, lossy encoding |
| Rust | image | yes | lossless | high-level, many formats |
| PHP | GD | yes | yes | bundled with PHP, no animation |
| PHP | Imagick | yes | yes | ImageMagick extension, animation |
By language#
- WebP libraries for C/C++ Open-source C/C++ library to read and write WebP images: libwebp, Google's reference implementation, with lossy, lossless and animated WebP examples.
- WebP libraries for C# Open-source C# libraries to read and write WebP images: ImageSharp, SkiaSharp and Magick.NET. Lossy, lossless and animated WebP with code examples.
- WebP libraries for Java Open-source Java libraries to read and write WebP images: the webp-imageio plugin (libwebp via JNI) and the pure Java TwelveMonkeys ImageIO WebP reader.
- WebP libraries for Go Open-source Go libraries for WebP: golang.org/x/image/webp (pure Go decoder) and gen2brain/webp (libwebp without cgo, encode, decode, animation).
- WebP libraries for Python Open-source Python libraries to read and write WebP images: Pillow (lossy, lossless, animated WebP, metadata) and OpenCV. Code examples.
- WebP libraries for Ruby Open-source Ruby library to read and write WebP images: ruby-vips, the libvips binding, with lossy, lossless and animated WebP code examples.
- WebP libraries for Rust Open-source Rust libraries for WebP images: image-webp (pure Rust), webp (libwebp bindings with lossy encoding) and the image crate. Code examples.
- WebP libraries for PHP Open-source PHP extensions to read and write WebP images: GD (bundled with PHP) and Imagick (ImageMagick). Lossy and lossless WebP code examples.