Kck.Documents.ImageSharp
4.8.0
Removed in Kck 5.0. Use Kck.Documents.SkiaSharp (MIT). Migration: docs/migrations/v4-to-v5.md, section 8.
dotnet add package Kck.Documents.ImageSharp --version 4.8.0
NuGet\Install-Package Kck.Documents.ImageSharp -Version 4.8.0
<PackageReference Include="Kck.Documents.ImageSharp" Version="4.8.0" />
<PackageVersion Include="Kck.Documents.ImageSharp" Version="4.8.0" />
<PackageReference Include="Kck.Documents.ImageSharp" />
paket add Kck.Documents.ImageSharp --version 4.8.0
#r "nuget: Kck.Documents.ImageSharp, 4.8.0"
#:package Kck.Documents.ImageSharp@4.8.0
#addin nuget:?package=Kck.Documents.ImageSharp&version=4.8.0
#tool nuget:?package=Kck.Documents.ImageSharp&version=4.8.0
Kck.Documents.ImageSharp
SixLabors.ImageSharp-backed IImageProcessor for server-side image resizing, format conversion, and quality adjustment.
Dependency: SixLabors.ImageSharp 4.x (fixes GHSA-j3p4-wp97-rph4, GHSA-j9gm-c75j-xc9q, GHSA-jjfr-hcj7-qf5w, GHSA-gwg2-r3hj-4w44 and GHSA-wmxv-xphr-5c9g present in 3.x). ImageSharp is licensed under the Six Labors Split License; if your application also references ImageSharp directly, check whether your use requires a Six Labors license.
Installation
dotnet add package Kck.Documents.ImageSharp
Quick Start
using Kck.Documents.Abstractions;
// Program.cs
builder.Services.AddKckDocumentsImageSharp();
// Resize and convert an uploaded image
app.MapPost("/thumbnail", async (IFormFile file, IImageProcessor images, CancellationToken ct) =>
{
await using var input = file.OpenReadStream();
var webp = await images.ResizeAsync(input, new ImageProcessingOptions
{
Width = 200,
Height = 200,
OutputFormat = "webp",
Quality = 85
}, ct);
return Results.File(webp, "image/webp");
}).DisableAntiforgery();
Options (ImageProcessingOptions)
| Property | Description | Default |
|---|---|---|
Width / Height |
Target size in pixels; null keeps the source dimension |
null |
MaintainAspectRatio |
Fit inside the box instead of stretching | true |
OutputFormat |
jpeg (jpg), png, webp, gif, bmp; null keeps the source format (JPEG if the source format is not one of these) |
null |
Quality |
Encoder quality 1-100 (JPEG, WebP) | 80 |
Any other OutputFormat / ConvertFormatAsync target (for example avif) throws NotSupportedException.
Resources
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Kck.Documents.Abstractions (>= 4.8.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.14)
- SixLabors.ImageSharp (>= 4.1.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.