WebPWrapper 1.6.0

dotnet add package WebPWrapper --version 1.6.0
                    
NuGet\Install-Package WebPWrapper -Version 1.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebPWrapper" Version="1.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebPWrapper" Version="1.6.0" />
                    
Directory.Packages.props
<PackageReference Include="WebPWrapper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WebPWrapper --version 1.6.0
                    
#r "nuget: WebPWrapper, 1.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WebPWrapper@1.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WebPWrapper&version=1.6.0
                    
Install as a Cake Addin
#tool nuget:?package=WebPWrapper&version=1.6.0
                    
Install as a Cake Tool

WebPWrapper

Unit Test NuGet Version NuGet Download GitHub license

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

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
1.6.0 126 10/25/2026
1.5.0 4,995 2/3/2025
1.4.0 600 12/19/2024
1.3.2 3,932 1/25/2024
1.3.0 3,864 12/15/2022
1.2.1 2,590 7/1/2022
1.2.0 813 6/30/2022
1.0.2 5,219 5/18/2019