Imazen.WebP
11.0.0
Prefix Reserved
dotnet add package Imazen.WebP --version 11.0.0
NuGet\Install-Package Imazen.WebP -Version 11.0.0
<PackageReference Include="Imazen.WebP" Version="11.0.0" />
<PackageVersion Include="Imazen.WebP" Version="11.0.0" />
<PackageReference Include="Imazen.WebP" />
paket add Imazen.WebP --version 11.0.0
#r "nuget: Imazen.WebP, 11.0.0"
#:package Imazen.WebP@11.0.0
#addin nuget:?package=Imazen.WebP&version=11.0.0
#tool nuget:?package=Imazen.WebP&version=11.0.0
Imazen.WebP — .NET Bindings for libwebp
Encode, decode, and animate WebP images from .NET. Supports both System.Drawing.Bitmap and raw pixel buffer APIs for cross-platform use.
Features
- Encode & Decode — lossy, lossless, and advanced config encoding; decode to Bitmap or raw byte arrays
- Animation — decode animated WebP to individual frames; encode frames into animated WebP
- Cross-Platform — raw buffer APIs (
WebPEncoder,WebPDecoder) work everywhere withoutSystem.Drawing - 7 Platform Runtimes — native libwebp binaries for
win-x64,win-x86,win-arm64,linux-x64,linux-arm64,osx-x64,osx-arm64 - Multi-Framework — targets
net472,net48,netstandard2.0, andnet8.0 - Advanced Config — fluent
WebPEncoderConfigbuilder for quality, method, lossless presets, near-lossless, alpha quality, sharp YUV, and more - Probing —
WebPInforetrieves dimensions, alpha, animation, and format without full decoding
Quick Start
Install
dotnet add package Imazen.WebP.AllPlatforms
Or install only the runtime you need (see Packages below).
Encode a Bitmap
using Imazen.WebP;
var encoder = new SimpleEncoder();
using var bitmap = new Bitmap("input.png");
using var stream = File.Create("output.webp");
// Lossy encoding (quality 0–100), or -1 for lossless
encoder.Encode(bitmap, stream, 80);
Decode a Bitmap
using Imazen.WebP;
var decoder = new SimpleDecoder();
byte[] webpBytes = File.ReadAllBytes("image.webp");
using Bitmap bitmap = decoder.DecodeFromBytes(webpBytes, webpBytes.LongLength);
Decode to Raw Pixels (Cross-Platform)
using Imazen.WebP;
byte[] webpBytes = File.ReadAllBytes("image.webp");
byte[] pixels = WebPDecoder.Decode(webpBytes, out int width, out int height, WebPPixelFormat.Rgba);
// pixels is now width * height * 4 bytes of RGBA data
Encode from Raw Pixels (Cross-Platform)
using Imazen.WebP;
byte[] encoded = WebPEncoder.Encode(rgbaPixels, width, height, width * 4, WebPPixelFormat.Rgba, quality: 80);
File.WriteAllBytes("output.webp", encoded);
Advanced Encoding Config
using Imazen.WebP;
var config = new WebPEncoderConfig()
.SetQuality(85)
.SetMethod(6) // Slowest, best compression
.SetSharpYuv() // Better color fidelity
.SetSnsStrength(50)
.SetFilterStrength(20);
var encoder = new SimpleEncoder();
using var bitmap = new Bitmap("input.png");
using var stream = File.Create("output.webp");
encoder.Encode(bitmap, stream, config);
Decode Animation
using Imazen.WebP;
byte[] animatedWebP = File.ReadAllBytes("animation.webp");
using var decoder = new AnimDecoder(animatedWebP);
Console.WriteLine($"{decoder.Info.FrameCount} frames, {decoder.Info.Width}x{decoder.Info.Height}");
foreach (var frame in decoder.DecodeAllFrames())
{
// frame.Pixels = BGRA byte array for the full canvas
// frame.TimestampMs, frame.DurationMs
}
Encode Animation
using Imazen.WebP;
using var encoder = new AnimEncoder(width, height, loopCount: 0);
encoder.AddFrame(frame1Bgra, timestampMs: 0, quality: 80);
encoder.AddFrame(frame2Bgra, timestampMs: 100, quality: 80);
encoder.AddFrame(frame3Bgra, timestampMs: 200, quality: 80);
byte[] animatedWebP = encoder.Assemble();
File.WriteAllBytes("animation.webp", animatedWebP);
Probe Image Info
using Imazen.WebP;
byte[] data = File.ReadAllBytes("image.webp");
var info = WebPInfo.GetImageInfo(data);
Console.WriteLine($"{info.Width}x{info.Height}, alpha={info.HasAlpha}, animated={info.HasAnimation}");
Packages
| Package | Description |
|---|---|
Imazen.WebP |
Managed bindings (requires a runtime package) |
Imazen.WebP.AllPlatforms |
Managed bindings + all 7 native runtimes |
Imazen.WebP.NativeRuntime.win-x64 |
Windows x64 native libraries |
Imazen.WebP.NativeRuntime.win-x86 |
Windows x86 native libraries |
Imazen.WebP.NativeRuntime.win-arm64 |
Windows ARM64 native libraries |
Imazen.WebP.NativeRuntime.linux-x64 |
Linux x64 native libraries |
Imazen.WebP.NativeRuntime.linux-arm64 |
Linux ARM64 native libraries |
Imazen.WebP.NativeRuntime.osx-x64 |
macOS x64 native libraries |
Imazen.WebP.NativeRuntime.osx-arm64 |
macOS ARM64 (Apple Silicon) native libraries |
Platform Support
| OS | Architecture | .NET Framework 4.7.2+ | .NET Standard 2.0 | .NET 8+ |
|---|---|---|---|---|
| Windows | x64 | Yes | Yes | Yes |
| Windows | x86 | Yes | Yes | Yes |
| Windows | ARM64 | Yes (.NET 4.8.1+) | Yes | Yes |
| Linux | x64 | — | Yes | Yes |
| Linux | ARM64 | — | Yes | Yes |
| macOS | x64 | — | Yes | Yes |
| macOS | ARM64 | — | Yes | Yes |
API Reference
Full API documentation is available at imazen.github.io/libwebp-net.
License
MIT — Copyright 2012–2026 Imazen LLC
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
-
.NETFramework 4.8
-
.NETStandard 2.0
- System.Drawing.Common (>= 8.0.24)
-
net8.0
- System.Drawing.Common (>= 8.0.24)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Imazen.WebP:
| Package | Downloads |
|---|---|
|
dk.zunk.SpriteBundle
A bundle that generates sprites for css images |
|
|
IM.HttpUtils
Package Description |
|
|
Imazen.WebP.AllPlatforms
Complete WebP encoding/decoding package for .NET — includes managed bindings and native libwebp for all supported platforms. |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Imazen.WebP:
| Repository | Stars |
|---|---|
|
imazen/resizer
The official repository for ImageResizer
|
|
|
Torrunt/vimage
A simplistic image viewer for Windows, inspired by vjpeg.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.0 | 457 | 2/27/2026 |
| 11.0.0-preview | 89 | 2/27/2026 |
| 10.0.1 | 304,298 | 12/31/2016 |
| 9.0.1 | 37,636 | 10/24/2015 |
| 4.0.0-prerelease0881 | 1,852 | 8/11/2015 |
| 4.0.0-prerelease0877 | 1,610 | 7/7/2015 |
| 3.4.3 | 26,761 | 5/8/2014 |
| 3.4.2 | 9,491 | 11/26/2013 |
| 3.4.1 | 1,797 | 10/30/2013 |
| 3.4.0 | 1,798 | 10/17/2013 |
| 3.3.3 | 2,382 | 3/2/2013 |
| 3.3.2 | 1,779 | 1/24/2013 |
| 3.3.1 | 1,856 | 12/20/2012 |
| 3.3.0 | 9,827 | 12/4/2012 |