ScriptsJul 13, 2026·2 min read

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.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
ImageSharp Overview
Direct install command
npx -y tokrepo@latest install e87f0ee2-7e94-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

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

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets