![]() |
VOOZH | about |
dotnet add package XperienceCommunity.ImageProcessing --version 3.0.0
NuGet\Install-Package XperienceCommunity.ImageProcessing -Version 3.0.0
<PackageReference Include="XperienceCommunity.ImageProcessing" Version="3.0.0" />
<PackageVersion Include="XperienceCommunity.ImageProcessing" Version="3.0.0" />Directory.Packages.props
<PackageReference Include="XperienceCommunity.ImageProcessing" />Project file
paket add XperienceCommunity.ImageProcessing --version 3.0.0
#r "nuget: XperienceCommunity.ImageProcessing, 3.0.0"
#:package XperienceCommunity.ImageProcessing@3.0.0
#addin nuget:?package=XperienceCommunity.ImageProcessing&version=3.0.0Install as a Cake Addin
#tool nuget:?package=XperienceCommunity.ImageProcessing&version=3.0.0Install as a Cake Tool
This package provides a way to resize images and convert them to webp, jpg, and png formats. It supports images from Media libraries and Content hub items stored as Content item assets.
Before using this package, consider Kentico's native Image Variants feature introduced in recent versions. The native solution:
This package is still useful if you need:
cover, contain, fill) and crop positioningFuture deprecation: As Kentico's native solution matures and adds more features, this package may be deprecated. For new projects, we recommend starting with the native Image Variants feature.
| Xperience Version | Library Version |
|---|---|
| >= 31.0.0 | 3.0.0+ |
| >= 30.11.1 | 2.x |
| >= 29.1.4 | 1.x |
Add the package to your application using the .NET CLI
dotnet add package XperienceCommunity.ImageProcessing
Install NuGet package above.
Add the following configuration to your appsettings.json:
{
"ImageProcessing": {
"ProcessMediaLibrary": true,
"ProcessContentItemAssets": true,
"MaxWidth": 5000,
"MaxHeight": 5000,
"MaxSideSize": 5000,
"Quality": 80
}
}
ProcessMediaLibrary: Set to true to enable image processing for Media library images. Defaults to true.ProcessContentItemAssets: Set to true to enable image processing for Content Hub assets. Defaults to true.MaxWidth: Maximum allowed width in pixels. Requests exceeding this will be capped. Defaults to 5000.MaxHeight: Maximum allowed height in pixels. Requests exceeding this will be capped. Defaults to 5000.MaxSideSize: Maximum allowed value for the maxSideSize parameter. Requests exceeding this will be capped. Defaults to 5000.Quality: JPEG/WebP encoding quality (1-100). Higher values produce better quality but larger file sizes. Defaults to 80.Register the Image Processing middleware using app.UseXperienceCommunityImageProcessing():
var builder = WebApplication.CreateBuilder(args);
// ...
builder.Services.Configure<ImageProcessingOptions>(builder.Configuration.GetSection("ImageProcessing"));
var app = builder.Build();
app.UseKentico();
// ...
app.UseXperienceCommunityImageProcessing();
You should be able to use the width, height, and maxSideSize query parameters on your image URLs to resize the image. Examples:
https://yourdomain.com/getmedia/rest-of-your-asset-url?width=100
https://yourdomain.com/getContentAsset/rest-of-your-asset-url?height=100
You can also use the format query parameter to convert the image to a different format. Allowed values are: webp, jpg and png. Example:
webp:
https://yourdomain.com/getmedia/rest-of-your-asset-url?format=webp
png:
https://yourdomain.com/getContentAsset/rest-of-your-asset-url?format=png
Use the fit parameter to control how images are resized. Available modes:
contain (default): Fit image inside dimensions, maintaining aspect ratio
https://yourdomain.com/getmedia/rest-of-your-asset-url?width=500&height=500&fit=contain
cover: Fill dimensions exactly, cropping excess while maintaining aspect ratio
https://yourdomain.com/getmedia/rest-of-your-asset-url?width=500&height=500&fit=cover
fill: Stretch image to exact dimensions, ignoring aspect ratio
https://yourdomain.com/getmedia/rest-of-your-asset-url?width=500&height=500&fit=fill
Use the crop parameter with fit=cover to control crop positioning:
center (default): Crop from center
https://yourdomain.com/getmedia/rest-of-your-asset-url?width=500&height=500&fit=cover&crop=center
north, south, east, west: Crop from edges
https://yourdomain.com/getmedia/rest-of-your-asset-url?width=500&height=500&fit=cover&crop=north
northeast, northwest, southeast, southwest: Crop from corners
https://yourdomain.com/getmedia/rest-of-your-asset-url?width=500&height=500&fit=cover&crop=southeast
Strongly recommended: Place a CDN (like Cloudflare, Azure CDN, or CloudFront) in front of your website for production deployments.
Cache-Control: public, max-age=31536000 (1 year) for optimal cachingWithout a CDN, every unique image variant will be processed on your server, which can be memory and CPU intensive.
The middleware automatically validates and clamps dimension parameters:
width, height, and maxSideSize values exceeding the configured maximums are automatically cappedMaxWidth, MaxHeight, and MaxSideSize in configuration based on your needsThis prevents abuse while ensuring requests always succeed with reasonable values.
Feel free to submit issues or pull requests to the repository, this is a community package and everyone is welcome to support.
Distributed under the MIT License. See for more information.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on XperienceCommunity.ImageProcessing:
| Package | Downloads |
|---|---|
|
XperienceCommunity.Baseline.Core.RCL.Xperience
The Baseline a set of Core Systems, Tools, and Structure to ensure a superior Kentico Website that's easy to migrate, for Kentico Xperience 13 and eventually Xperience by Kentico |
This package is not used by any popular GitHub repositories.