Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 13, 2026·2 min de lecture

ImageSharp — Cross-Platform 2D Graphics Library for .NET

A fully managed, cross-platform image processing library for .NET that handles resizing, cropping, format conversion, and drawing without native dependencies.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
ImageSharp Overview
Commande d'installation directe
npx -y tokrepo@latest install e87f0ee2-7e94-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

ImageSharp is a fully managed, cross-platform 2D graphics library for .NET. It replaces the legacy System.Drawing dependency with a modern, allocation-friendly API that runs on Windows, Linux, macOS, and even in containers without native GDI+ or libgdiplus dependencies.

What ImageSharp Does

  • Loads and saves images in JPEG, PNG, BMP, GIF, TIFF, TGA, and WebP formats
  • Provides image processing operations like resize, crop, rotate, and color adjustment
  • Draws text, shapes, and paths onto images via the ImageSharp.Drawing package
  • Reads and writes EXIF, IPTC, and XMP metadata
  • Handles animated GIFs with per-frame processing support

Architecture Overview

ImageSharp operates on a pixel buffer abstraction (Image<TPixel>) that supports multiple pixel formats. Processing operations are applied through a mutation pipeline that chains transformations efficiently. The library uses SIMD-accelerated operations via .NET's Vector types and avoids unmanaged memory, making it safe for serverless and containerized environments.

Self-Hosting & Configuration

  • Install via NuGet: dotnet add package SixLabors.ImageSharp
  • Add SixLabors.ImageSharp.Drawing for text and shape rendering
  • Configure memory allocation limits with Configuration.Default.MemoryAllocator
  • Set maximum image dimensions to prevent denial-of-service from large uploads
  • Use SixLabors.ImageSharp.Web for ASP.NET Core middleware with caching and on-the-fly processing

Key Features

  • Fully managed with zero native dependencies — runs anywhere .NET runs
  • Thread-safe image processing suitable for server-side workloads
  • Pluggable format decoders and encoders for custom image formats
  • Memory-efficient processing with configurable allocation strategies
  • SIMD-accelerated pixel operations for high throughput

Comparison with Similar Tools

  • System.Drawing — Legacy GDI+ wrapper, Windows-only in practice; ImageSharp is cross-platform and actively maintained
  • SkiaSharp — Wraps native Skia library; ImageSharp is fully managed with no native binaries to ship
  • Magick.NET — Wraps ImageMagick; ImageSharp has no native dependency but covers fewer formats
  • Sharp (Node.js) — libvips-based; ImageSharp serves the same role in the .NET ecosystem

FAQ

Q: Is ImageSharp free for commercial use? A: Yes under the Apache 2.0 license for SixLabors.ImageSharp. The Drawing package uses a Six Labors Split License.

Q: Can it handle large images? A: Yes, memory allocation is configurable to stream large images without loading entirely into RAM.

Q: Does it support WebP? A: Yes, WebP encoding and decoding is supported out of the box.

Q: How does performance compare to native libraries? A: ImageSharp is competitive for common operations and benefits from .NET's JIT and SIMD optimizations.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires