WebPWrapper 1.0.2

.NET Standard 2.0的WebP轉檔器包裝套件

Install-Package WebPWrapper -Version 1.0.2
dotnet add package WebPWrapper --version 1.0.2
<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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WebPWrapper, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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); // 解碼
}

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); // 解碼
}

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 History

Version Downloads Last updated
1.0.2 1,200 5/18/2019