WebPWrapper 1.6.0
dotnet add package WebPWrapper --version 1.6.0
NuGet\Install-Package WebPWrapper -Version 1.6.0
<PackageReference Include="WebPWrapper" Version="1.6.0" />
<PackageVersion Include="WebPWrapper" Version="1.6.0" />
<PackageReference Include="WebPWrapper" />
paket add WebPWrapper --version 1.6.0
#r "nuget: WebPWrapper, 1.6.0"
#:package WebPWrapper@1.6.0
#addin nuget:?package=WebPWrapper&version=1.6.0
#tool nuget:?package=WebPWrapper&version=1.6.0
WebPWrapper
WebPWrapper is a .NET library that builds and runs cwebp and dwebp command-line operations through stream-based encoder and decoder APIs.
For more information about WebP and the WebP CLI, see the WebP documentation.
Getting started
Install the library
dotnet add package WebPWrapper
Encode an image
using System.Drawing;
using System.IO;
using WebPWrapper;
using WebPWrapper.Encoder;
WebPExecuteDownloader.Download();
var encoder = new WebPEncoderBuilder()
.Resize(100, 0)
.AlphaConfig(config => config.TransparentProcess(
TransparentProcesses.Blend,
Color.Yellow))
.CompressionConfig(config => config.Lossless(lossless => lossless.Quality(75)))
.Build();
using (var input = File.OpenRead("input.png"))
using (var output = File.Create("output.webp"))
{
encoder.Encode(input, output);
}
WebPExecuteDownloader.Download() installs the platform's WebP CLI tools before the builder uses them. Applications that manage their own executables can pass the executable path to WebPEncoderBuilder or WebPDecoderBuilder instead.
Containerized applications
For containerized applications, avoid downloading the CLI at runtime. Install it while building the image, then pass its executable path to the WebPEncoderBuilder and WebPDecoderBuilder constructors.
Tests
Run the deterministic, offline test suite with:
dotnet test src/WebPWrapper.sln
Tests that download and exercise the official WebP CLI are isolated in the integration test project. Run them explicitly with:
dotnet test src/WebPWrapper.IntegrationTest/WebPWrapper.IntegrationTest.csproj
Documentation
- Usage and API overview: stream encoding/decoding, async cancellation, builder options, and public type responsibilities.
- CLI download security: integrity verification, extraction limits, installation, and failure behavior.
- NuGet.org publishing: Trusted Publishing setup and the tag-based release process.
| 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 was computed. 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- SharpZipLib (>= 1.4.2)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on WebPWrapper:
| Package | Downloads |
|---|---|
|
ImageToWebp
当用户访问.png .jpg .gif文件时,根据客户浏览器对webp格式的支持程度,自动压缩为webp图片,响应给用户, 不支持webp的用户,将以传统图片压缩方式压缩图片,响应给用户 |
|
|
MX.Core
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.