Core5.ImageResizer 10.0.1

dotnet add package Core5.ImageResizer --version 10.0.1
                    
NuGet\Install-Package Core5.ImageResizer -Version 10.0.1
                    
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="Core5.ImageResizer" Version="10.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Core5.ImageResizer" Version="10.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Core5.ImageResizer" />
                    
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 Core5.ImageResizer --version 10.0.1
                    
#r "nuget: Core5.ImageResizer, 10.0.1"
                    
#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 Core5.ImageResizer@10.0.1
                    
#: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=Core5.ImageResizer&version=10.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Core5.ImageResizer&version=10.0.1
                    
Install as a Cake Tool

ImageResizer.AspNetCore (Core5.ImageResizer)

A lightweight, fast image processing middleware for ASP.NET Core that enables on-the-fly image resizing, cropping, format conversion, and watermarking through simple URL query parameters.

Note: This is a maintained fork of ImageResizer.AspNetCore updated to support newer .NET versions (targets .NET 8.0, .NET 9.0 and .NET 10.0).

Features

  • Resize images - Scale images to specific dimensions
  • Crop images - Extract specific regions from images
  • Format conversion - Convert between PNG, JPG, and JPEG
  • Image quality control - Adjust compression quality
  • Auto-rotation - Automatically rotate images based on EXIF orientation
  • Padding mode - Add padding to maintain aspect ratio
  • Max mode - Scale to fit within bounds while maintaining aspect ratio
  • Crop mode - Crop to exact dimensions
  • Stretch mode - Stretch image to exact dimensions
  • Watermarking - Add text or image watermarks
  • Memory caching - Automatically cache processed images
  • Multi-framework support - Supports .NET 8.0, .NET 9.0 and .NET 10.0

Installation

Install via NuGet:

dotnet add package Core5.ImageResizer

Or using Package Manager Console:

Install-Package Core5.ImageResizer

Quick Start

1. Register the Service

In your Program.cs (ASP.NET Core 6+):

using ImageResizer.AspNetCore;

var builder = WebApplication.CreateBuilder(args);

// Add ImageResizer service
builder.Services.AddImageResizer();

var app = builder.Build();

// Use ImageResizer middleware
app.UseStaticFiles();
app.UseImageResizer();

app.Run();

Or in Startup.cs (ASP.NET Core 5):

public void ConfigureServices(IServiceCollection services)
{
    services.AddImageResizer();
}

public void Configure(IApplicationBuilder app)
{
    app.UseStaticFiles();
    app.UseImageResizer();
}

2. Use in HTML

Simply add query parameters to your image URLs:

<img src="~/images/photo.jpg?w=200" alt="Resized" />
<img src="~/images/photo.jpg?w=200&h=300" alt="Resized with height" />

Usage Examples

Basic Resizing

Resize to a specific width (height auto-calculated to maintain aspect ratio):

<img src="~/images/photo.jpg?w=300" alt="Width 300px" />

Resize to a specific height (width auto-calculated):

<img src="~/images/photo.jpg?h=400" alt="Height 400px" />

Resize to specific width and height with auto-detection of best fit:

<img src="~/images/photo.jpg?w=200&h=200" alt="Max fit" />

Format Conversion

Convert to PNG:

<img src="~/images/photo.jpg?format=png" alt="PNG format" />

Convert to JPEG with quality setting:

<img src="~/images/photo.png?format=jpg&quality=80" alt="JPEG format" />

Resize Modes

Max mode (default) - Fit within bounds maintaining aspect ratio:

<img src="~/images/photo.jpg?w=200&h=200&mode=max" alt="Max fit" />

Pad mode - Fit within bounds and pad with white space:

<img src="~/images/photo.jpg?w=200&h=200&mode=pad" alt="Padded" />

Crop mode - Crop to exact dimensions from center:

<img src="~/images/photo.jpg?w=200&h=200&mode=crop" alt="Cropped" />

Stretch mode - Stretch to exact dimensions (may distort):

<img src="~/images/photo.jpg?w=200&h=200&mode=stretch" alt="Stretched" />

Quality Control

Adjust compression quality (1-100, default 100):

<img src="~/images/photo.jpg?w=800&quality=75" alt="Optimized" />

Auto-Rotation

Enable automatic EXIF-based rotation:

<img src="~/images/photo.jpg?autorotate=true" alt="Auto-rotated" />

Combined Parameters

Use multiple parameters together:


<img src="~/images/photo.jpg?w=500&h=300&mode=crop&format=jpg&quality=80" alt="Optimized" />


<img src="~/images/photo.jpg?w=400&format=png&autorotate=true" alt="Responsive" />

Watermarking

Add text watermark (requires ImageResizerJson.json configuration):

<img src="~/images/photo.jpg?w=400&wmtext=1" alt="With watermark" />

Add image watermark:

<img src="~/images/photo.jpg?w=400&wmimage=1" alt="With image watermark" />

Query Parameters Reference

Parameter Type Default Description
w int 0 Width in pixels (0 = auto-calculate)
h int 0 Height in pixels (0 = auto-calculate)
mode string max Resize mode: max, pad, crop, stretch
format string original Output format: jpg, jpeg, png
quality int 100 JPEG quality (1-100)
autorotate bool false Auto-rotate based on EXIF orientation
wmtext int 0 Text watermark ID (requires config)
wmimage int 0 Image watermark ID (requires config)

Watermark Configuration

To use watermarks, create an ImageResizerJson.json file in your wwwroot directory:

{
  "WatermarkTextList": [
    {
      "Key": 1,
      "Text": "© 2024 MyCompany",
      "Color": "#FFFFFF",
      "Size": 30,
      "Opacity": 0.7
    }
  ],
  "WatermarkImageList": [
    {
      "Key": 1,
      "ImagePath": "/images/watermark.png",
      "Opacity": 0.5
    }
  ]
}

Performance

  • Memory caching - Processed images are automatically cached in memory
  • Fast processing - Uses SkiaSharp for efficient image manipulation
  • Responsive - Query parameters are parsed only when needed
  • Lightweight - Minimal dependencies

Supported Image Formats

  • Input: PNG, JPG, JPEG
  • Output: PNG, JPG, JPEG

Browser Compatibility

Works with all modern browsers that support standard image tags. The resizing happens server-side, so all clients can view the resized images.

License

See LICENSE file for details.

Support

For issues, feature requests, or questions:

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible.  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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.1 654 12/3/2025
9.0.1 202 12/3/2024
6.0.2 363 6/29/2023
6.0.1 1,660 4/24/2022
2.0.3 1,044 12/4/2020
2.0.2 560 11/26/2020
2.0.1 535 11/26/2020

Add Multi Targeting
Fix Middleware static file lookup path