Nextended.Imaging 10.1.32

There is a newer version of this package available.
See the version list below for details.
dotnet add package Nextended.Imaging --version 10.1.32
                    
NuGet\Install-Package Nextended.Imaging -Version 10.1.32
                    
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="Nextended.Imaging" Version="10.1.32" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nextended.Imaging" Version="10.1.32" />
                    
Directory.Packages.props
<PackageReference Include="Nextended.Imaging" />
                    
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 Nextended.Imaging --version 10.1.32
                    
#r "nuget: Nextended.Imaging, 10.1.32"
                    
#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 Nextended.Imaging@10.1.32
                    
#: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=Nextended.Imaging&version=10.1.32
                    
Install as a Cake Addin
#tool nuget:?package=Nextended.Imaging&version=10.1.32
                    
Install as a Cake Tool

Nextended

Nextended.Imaging

NuGet Downloads License

Image processing โ€” aspect-preserving resize, crop, colour replacement, brightness-based foreground picking, thumbnail generation, byte/data-URL conversion and MIME detection from magic bytes.

๐Ÿ“– Documentation: English ยท Deutsch

Installation

dotnet add package Nextended.Imaging

Warning This package builds on System.Drawing.Common, which Microsoft supports on Windows only from .NET 7 onwards. On Linux and macOS the System.Drawing types throw PlatformNotSupportedException. For cross-platform image work use ImageSharp or SkiaSharp instead โ€” this package targets Windows services, desktop apps and Windows-hosted web apps.

Feature map

Area API
Loading FromFile, FromFileAsync, FromUrl, FromByteArray, FromHtmlImageString, LoadCloneFromFile, CloneImage
Resizing ResizeImage(size), ResizeImage(size, ResizeMode), ResizeImage(size, useSizeAsHeight), CalculateResize(imageSize, boxSize)
Cropping & colour CropBitmap, ReplaceColor, ChangeColor, ReadImageColor, GetColor
Contrast (Miscellaneous) GetWeightedBrightness, GetOptimalForegroundColor โ€” pick readable text over an arbitrary image or colour
Thumbnails GetImageThumbnailData(image, size, useSizeAsHeight), GetMinSizedImageThumbnailData(image, size, โ€ฆ)
Conversion ConvertImageToByteArray, ToByteArray, ToHtml, ToHtmlImageString
Inspection GetDimensions, IsValidImage (bytes, path or BinaryReader), GetMimeType, GetContentType, ParseSize, ImageSize
MIME sniffing (Miscellaneous) GetMimeFromBytes โ€” reads the magic bytes rather than trusting the extension
Interop (Miscellaneous) FromDelphiColor, ToDelphiColor for legacy Delphi colour values

Quick start

Resize inside a bounding box, keeping the aspect ratio

using Nextended.Imaging;

using var image = ImageHelper.FromFile(@"C:\uploads\photo.jpg");

// CalculateResize works out the largest size that fits the box without distortion.
var target = ImageHelper.CalculateResize(image.Size, new Size(800, 600));
using var resized = image.ResizeImage(target);

resized.Save(@"C:\out\photo-800.jpg", ImageFormat.Jpeg);

Pass a ResizeMode when you want to control cropping versus letterboxing, or use the single-dimension overload:

// 400px wide, height follows the aspect ratio
using var thumb = ImageHelper.ResizeImage(image, 400);

// 400px tall instead
using var tall = ImageHelper.ResizeImage(image, 400, useSizeAsHeight: true);

Thumbnails as bytes

byte[] thumbnail = ImageHelper.GetImageThumbnailData(image, 200);

// Or: never go below a minimum in either dimension
byte[] minSized = ImageHelper.GetMinSizedImageThumbnailData(image, new Size(120, 120));

Detect the real type from the bytes, not the file extension

string mime = Miscellaneous.GetMimeFromBytes(uploadedBytes);   // reads the magic bytes
bool ok     = ImageHelper.IsValidImage(uploadedBytes);

A .png extension on a renamed executable does not fool GetMimeFromBytes โ€” it inspects the header signature. Useful as an upload guard.

Readable text over an arbitrary image

var background = ImageHelper.FromFile(path).ReadImageColor();      // dominant colour
var foreground = Miscellaneous.GetOptimalForegroundColor(background);  // black or white, by brightness

int brightness = background.GetWeightedBrightness();  // perceptual, not a plain average

Colour replacement

using var recoloured = ImageHelper.ReplaceColor(bitmap, Color.Magenta, Color.Transparent);

The classic "magenta means transparent" sprite sheet, without a manual pixel loop.

Embedding in HTML

string tag = ImageHelper.ToHtmlImageString(image);   // <img src="data:image/png;base64,โ€ฆ">

FromHtmlImageString is the inverse, so a data-URL round trip needs no manual base64 handling.

Caching thumbnails

Nextended.Imaging depends on Nextended.Cache, so thumbnail generation composes with expression-based caching:

var bytes = _cache.ExecuteWithCache(this, self => self.BuildThumbnail(imageId, 200));

Supported frameworks

  • net8.0
  • net9.0
  • net10.0

Dependencies

The Nextended family

The other 17 packages in the suite:

Core libraries

  • Nextended.Core โ€” Foundation library โ€” extension methods, custom types (Money, Date, BaseId, SuperType), class mapping, deep clone, encryption, hashing and the code-generation attributes.
  • Nextended.Cache โ€” Expression-based caching โ€” automatic cache keys from method expressions, CacheProvider with condition-based invalidation, thread-safe AddOrGetExisting.

Data access

  • Nextended.EF โ€” Entity Framework Core extensions โ€” graph loading (LoadGraphAsync, IncludeAll, MultiInclude), declarative include definitions, paging, dynamic sorting and bulk operations.

ASP.NET Core & web

  • Nextended.Web โ€” ASP.NET Core utilities โ€” zero-config OData (AddODataAuto), composable IQueryable OData appliers, strongly typed controller URLs, streaming download helpers and a background executor that can replay a captured request.
  • Nextended.ResponseFilters โ€” Fluent, provider-agnostic pipeline that redacts, masks, rounds, truncates, hashes, prunes and restructures response DTOs before serialization โ€” per request, per user, per permission.
  • Nextended.ResponseFilters.AspNetCore โ€” ASP.NET Core adapter for Nextended.ResponseFilters โ€” registers the pipeline as a global IAsyncResultFilter and replays structural edits against the serialized JSON tree.

UI libraries

  • Nextended.Blazor โ€” Blazor helpers โ€” IBrowserFile extensions (bytes, data URLs, downloads), a hierarchical model for browsing inside uploaded zip/tar/rar archives, MIME-type detection and component-parameter reflection.
  • Nextended.UI โ€” WPF and Windows desktop helpers โ€” a global input-binding manager with hold/sequence matching, DirectInput and XInput gamepad readers, key-bind capture controls, converters, behaviours, markup extensions and runtime-defined PropertyGrid types.

Code generation & tooling

  • Nextended.Imaging โ€” Image processing โ€” aspect-preserving resize, crop, colour replacement, brightness-based foreground picking, thumbnail generation, byte/data-URL conversion and MIME detection from magic bytes. (this package)
  • Nextended.CodeGen โ€” Roslyn source generator โ€” DTOs and interfaces from your entities, strongly typed classes from JSON/XML, lookup tables from Excel, and documentation from source files.

.NET Aspire hosting

  • Nextended.Aspire โ€” Conditional AppHost builder extensions โ€” WithReferenceIf / WaitForIf / WithExplicitStartIf, strongly typed environment variables from config objects, HTTPS dev-cert wiring, Docker guards, GitHub-source resources and npm app discovery.
  • Nextended.Aspire.Hosting.Supabase โ€” The complete Supabase stack โ€” Postgres, Auth (GoTrue), REST, Realtime, Storage, Studio, Kong and Edge Functions โ€” as one composable Aspire resource.
  • Nextended.Aspire.Hosting.N8n โ€” The n8n workflow-automation platform as an Aspire resource, with Postgres persistence, workflow import and a typed client for triggering workflows from .NET.
  • Nextended.Aspire.Hosting.Grafana โ€” Grafana, Prometheus, Loki, Tempo, Promtail, cAdvisor, postgres_exporter and the OpenTelemetry Collector as composable resources with auto-provisioned datasources.
  • Nextended.Aspire.Hosting.WebDataStudio โ€” WebDataStudio โ€” a browser database studio for PostgreSQL, MySQL, SQL Server, SQLite, Oracle, DuckDB, ClickHouse, MongoDB and Redis โ€” wired to the databases of your stack.
  • Nextended.Aspire.Hosting.AspireUI โ€” AspireUI โ€” the visual AppHost builder โ€” as a resource inside your own Aspire stack, with an optional pre-seeded admin user and a starter stack built from your project paths.
  • Nextended.Aspire.Hosting.LocalAI โ€” Self-hosted, OpenAI-compatible multimodal AI โ€” image generation, text-to-speech, speech-to-text and video โ€” with gallery model management, GPU support and Open WebUI.
  • Nextended.Aspire.Hosting.Php โ€” Run PHP endpoints inside your Aspire stack โ€” a docroot folder or a single router script served by PHP's built-in web server, with php.ini settings as fluent options.

License

GPL-3.0-or-later โ€” see LICENSE.

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.1.34 43 8/27/2026
10.1.33 86 8/24/2026
10.1.32 89 8/20/2026
10.1.31 81 8/19/2026
10.1.30 86 8/19/2026
10.1.21 110 7/30/2026
10.1.20 110 7/26/2026
10.1.19 103 7/23/2026
10.1.18 101 7/22/2026
10.1.17 100 7/21/2026
10.1.16 103 7/21/2026
10.1.15 102 7/21/2026
10.1.14 110 7/16/2026
10.1.13 105 7/12/2026
10.1.12 112 7/12/2026
10.1.11 119 7/6/2026
10.1.10 125 6/16/2026
10.1.9 127 5/29/2026
10.1.8 129 5/19/2026
10.1.7 117 5/16/2026
Loading failed