Zymergi.Imaging.Magick 11.4.0-alpha

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

Zymergi.Imaging.Magick

Magick.NET helpers for cropping images and converting between common web formats (CropTopPixels, CropBottomPixels, EditImage, ToMagickFormat, RearrangeBGRAToRGBA).

Targets .NET 10. No Zymergi dependencies. References Magick.NET-Q16-AnyCPU.

Install

dotnet add package Zymergi.Imaging.Magick

Register in Program.cs

Nothing to register. The helpers are static extension methods. Wrap them in your own service if you want to inject and fake them:

builder.Services.AddSingleton<IThumbnailer, MagickThumbnailer>();

Use it

using ImageMagick;
using Zymergi.Imaging.Magick;

public interface IThumbnailer { byte[] ToWebpBanner(byte[] image, int cropTop); }

public sealed class MagickThumbnailer : IThumbnailer
{
    public byte[] ToWebpBanner(byte[] image, int cropTop) =>
        image.CropTopPixels(cropTop).EditImage(img =>
        {
            img.Resize(1200, 0);
            return img;
        }, format: "image/webp");
}

app.MapPost("/images/banner", async (IFormFile file, IThumbnailer thumbs, CancellationToken ct) =>
{
    if (file.Length > 10 * 1024 * 1024) return Results.Problem(statusCode: 413, title: "Image too large");
    using var ms = new MemoryStream();
    await file.CopyToAsync(ms, ct);
    return Results.File(thumbs.ToWebpBanner(ms.ToArray(), 120), "image/webp");
}).DisableAntiforgery().RequireAuthorization();

Best practices

  • Image processing is CPU- and memory-heavy and synchronous. Limit upload size, limit concurrency (a SemaphoreSlim or a rate limiter), and move big jobs to a background queue.
  • Set Magick.NET resource limits for untrusted input, for example ResourceLimits.Memory and ResourceLimits.Width/Height, at startup.
  • Dispose every MagickImage you create. EditImage disposes the image it creates, and the one your callback returns.
  • Convert to WebP for the web, and store or cache the result instead of converting on every request.

Testing

Use small image fixtures in the test project and assert on the output size and format (new MagickImage(bytes).Width).

Gotchas

  • CropTopPixels takes an int and CropBottomPixels takes a uint.
  • ToMagickFormat maps image/svg+xml, image/apng, image/webp, image/gif, and image/jpeg. Every other value, including image/avif, silently becomes PNG.
  • Do not accept SVG from users without sanitizing it; SVG can carry script.
  • There are no async APIs.

Version notes

11.4.0-alpha: no API change.

Source: bitbucket.org/zymergy/zymergi.saas

Product 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. 
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
11.4.0-alpha 85 11/16/2026
11.3.0-alpha 73 11/12/2026
11.2.0-alpha 62 11/2/2026
11.1.1-alpha 81 10/4/2026
11.1.0-alpha 109 10/1/2026
11.0.6-alpha 117 7/10/2026
11.0.5-alpha 90 7/9/2026
11.0.4-alpha 86 7/6/2026
11.0.3-alpha 85 7/6/2026
11.0.2-alpha 89 6/30/2026
11.0.1-alpha 88 6/30/2026
11.0.0-alpha 87 6/30/2026