WebPWrapper 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package WebPWrapper --version 1.0.2
NuGet\Install-Package WebPWrapper -Version 1.0.2
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.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WebPWrapper --version 1.0.2
#r "nuget: WebPWrapper, 1.0.2"
#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.
// Install WebPWrapper as a Cake Addin
#addin nuget:?package=WebPWrapper&version=1.0.2

// Install WebPWrapper as a Cake Tool
#tool nuget:?package=WebPWrapper&version=1.0.2

WebPWrapper

Build Status NuGet Version NuGet Download Github license

這是一個可以在.NET Standard 2.0環境運行的WebP包裝套件。提供包裝好的CLI參數建構器幫助調用WebP CLI。

有關WebP詳細資訊請參考官方網站: https://developers.google.com/speed/webp/

快速上手

安裝套件

dotnet add package WebPWrapper

編碼

using WebPWrapper;
using WebPWrapper.Encoder;

WebPExecuteDownloader.Download();

var builder = new WebPEncoderBuilder();

var encoder = builder
	.Resize(100, 0) // 調整寬度為100,等比縮放(因為高度為0)
	.AlphaConfig(x => x // 透明處理設定
		.TransparentProcess(
			TransparentProcesses.Blend, // 透明部分將底色視為黃色混合
			Color.Yellow
		)
	)
	.CompressionConfig(x => x // 壓縮設定
		.Lossless(y => y.Quality(75)) // 使用無損壓縮且壓縮品質設為75
	) 
	.Build(); // 建立編碼器

using (var outputFile = File.Open("output.webp", FileMode.Create))
using (var inputFile = File.Open("input.png", FileMode.Open)) {
	encoder.Encode(inputFile, outputFile); // 編碼
}

解碼

using WebPWrapper;
using WebPWrapper.Decoder; 

WebPExecuteDownloader.Download();

var builder = new WebPDecoderBuilder();

var encoder = builder
	.Resize(32, 0) // 調整寬度為32,等比縮放(因為高度為0)
	.Build(); // 建立解碼器
 
using (var outputFile = File.Open("output.png", FileMode.Create))
using (var inputFile = File.Open("input.webp", FileMode.Open)) {
	encoder.Decode(inputFile, outputFile); // 解碼
}
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. 
.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 was computed.  net48 was computed.  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. 
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.3.2 780 1/25/2024
1.3.0 3,059 12/15/2022
1.2.1 2,129 7/1/2022
1.2.0 460 6/30/2022
1.0.2 4,245 5/18/2019