🖊️ Extensions to ImageSharp containing a cross-platform 2D polygon manipulation API and drawing operations.
See the codeImageSharp.Drawing is a cross-platform 2D drawing library built on top of ImageSharp. It adds a rich vector drawing model for composing raster images, rendering text, shaping paths, masking image-processing operations, and targeting CPU or WebGPU-backed drawing surfaces from the same DrawingCanvas API.
The core package targets .NET 10 and provides the default CPU backend. The optional SixLabors.ImageSharp.Drawing.WebGPU package adds GPU-backed rendering for native windows, external surfaces, and offscreen render targets.
PathBuilder geometry.SixLabors.Fonts, including rich text runs, fallback fonts, bidirectional text, vertical layout, glyph paths, text measurement, wrapped text, and text-on-path scenarios.canvas.Apply(...), or fill paths with images via ImageBrush.Image<TPixel> memory with the CPU backend, or into WebGPU windows, external host surfaces, and offscreen render targets with the WebGPU backend.Draw into an Image<TPixel> with the CPU backend:
image.Mutate(ctx => ctx.Paint(canvas =>
{
// A fill without geometry paints the entire canvas.
canvas.Fill(Brushes.Solid(Color.White));
// Brushes can be reused across paths or used directly for full-canvas fills.
canvas.Fill(new LinearGradientBrush(
new PointF(0, 0),
new PointF(400, 300),
GradientRepetitionMode.None,
new ColorStop(0F, Color.CornflowerBlue),
new ColorStop(1F, Color.MediumSeaGreen)));
// Built-in polygon types are regular IPath instances accepted by Fill and Draw.
canvas.Fill(Brushes.Solid(Color.HotPink), new EllipsePolygon(200, 200, 100));
canvas.Draw(Pens.Solid(Color.Navy, 3F), new RoundedRectanglePolygon(50, 50, 200, 100, 16));
}));
Draw into a native WebGPU window with the same canvas-facing API:
using WebGPUWindow window = new(new WebGPUWindowOptions
{
Title = "ImageSharp.Drawing",
Size = new Size(800, 600),
Format = WebGPUTextureFormat.Bgra8Unorm,
PresentMode = WebGPUPresentMode.Fifo,
});
window.Run(frame =>
{
DrawingCanvas canvas = frame.Canvas;
// WebGPU frames expose the same DrawingCanvas API as CPU image processing.
canvas.Fill(Brushes.Solid(Color.Black));
canvas.Fill(Brushes.Solid(Color.CornflowerBlue), new EllipsePolygon(400, 300, 120));
});
Support the efforts of the development of the Six Labors projects.
ImageSharp tag. Do not open issues for questions!This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the .NET Foundation Code of Conduct.
Install stable releases via NuGet; development releases are available via MyGet.
| Package Name | Release (NuGet) | Nightly (MyGet) |
|---|---|---|
SixLabors.ImageSharp.Drawing | ||
SixLabors.ImageSharp.Drawing.WebGPU |
If you prefer, you can compile ImageSharp.Drawing yourself (please do and help!)
Alternatively, you can work from command line and/or with a lightweight editor on both Linux/Unix and Windows:
To clone ImageSharp.Drawing locally, click the "Clone in [YOUR_OS]" button above or run the following git commands:
git clone https://github.com/SixLabors/ImageSharp.Drawing
If working with Windows please ensure that you have enabled log file paths in git (run as Administrator).
git config --system core.longpaths true
This repository contains git submodules. To add the submodules to the project, navigate to the repository root and type:
git submodule update --init --recursive
Please... Spread the word, contribute algorithms, submit performance improvements, unit tests, no input is too little. Make sure to read our Contribution Guide before opening a PR.
🖊️ Extensions to ImageSharp containing a cross-platform 2D polygon manipulation API and drawing operations.
See the codeImageSharp.Drawing is a cross-platform 2D drawing library built on top of ImageSharp. It adds a rich vector drawing model for composing raster images, rendering text, shaping paths, masking image-processing operations, and targeting CPU or WebGPU-backed drawing surfaces from the same DrawingCanvas API.
The core package targets .NET 10 and provides the default CPU backend. The optional SixLabors.ImageSharp.Drawing.WebGPU package adds GPU-backed rendering for native windows, external surfaces, and offscreen render targets.
PathBuilder geometry.SixLabors.Fonts, including rich text runs, fallback fonts, bidirectional text, vertical layout, glyph paths, text measurement, wrapped text, and text-on-path scenarios.canvas.Apply(...), or fill paths with images via ImageBrush.Image<TPixel> memory with the CPU backend, or into WebGPU windows, external host surfaces, and offscreen render targets with the WebGPU backend.Draw into an Image<TPixel> with the CPU backend:
image.Mutate(ctx => ctx.Paint(canvas =>
{
// A fill without geometry paints the entire canvas.
canvas.Fill(Brushes.Solid(Color.White));
// Brushes can be reused across paths or used directly for full-canvas fills.
canvas.Fill(new LinearGradientBrush(
new PointF(0, 0),
new PointF(400, 300),
GradientRepetitionMode.None,
new ColorStop(0F, Color.CornflowerBlue),
new ColorStop(1F, Color.MediumSeaGreen)));
// Built-in polygon types are regular IPath instances accepted by Fill and Draw.
canvas.Fill(Brushes.Solid(Color.HotPink), new EllipsePolygon(200, 200, 100));
canvas.Draw(Pens.Solid(Color.Navy, 3F), new RoundedRectanglePolygon(50, 50, 200, 100, 16));
}));
Draw into a native WebGPU window with the same canvas-facing API:
using WebGPUWindow window = new(new WebGPUWindowOptions
{
Title = "ImageSharp.Drawing",
Size = new Size(800, 600),
Format = WebGPUTextureFormat.Bgra8Unorm,
PresentMode = WebGPUPresentMode.Fifo,
});
window.Run(frame =>
{
DrawingCanvas canvas = frame.Canvas;
// WebGPU frames expose the same DrawingCanvas API as CPU image processing.
canvas.Fill(Brushes.Solid(Color.Black));
canvas.Fill(Brushes.Solid(Color.CornflowerBlue), new EllipsePolygon(400, 300, 120));
});
Support the efforts of the development of the Six Labors projects.
ImageSharp tag. Do not open issues for questions!This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information, see the .NET Foundation Code of Conduct.
Install stable releases via NuGet; development releases are available via MyGet.
| Package Name | Release (NuGet) | Nightly (MyGet) |
|---|---|---|
SixLabors.ImageSharp.Drawing | ||
SixLabors.ImageSharp.Drawing.WebGPU |
If you prefer, you can compile ImageSharp.Drawing yourself (please do and help!)
Alternatively, you can work from command line and/or with a lightweight editor on both Linux/Unix and Windows:
To clone ImageSharp.Drawing locally, click the "Clone in [YOUR_OS]" button above or run the following git commands:
git clone https://github.com/SixLabors/ImageSharp.Drawing
If working with Windows please ensure that you have enabled log file paths in git (run as Administrator).
git config --system core.longpaths true
This repository contains git submodules. To add the submodules to the project, navigate to the repository root and type:
git submodule update --init --recursive
Please... Spread the word, contribute algorithms, submit performance improvements, unit tests, no input is too little. Make sure to read our Contribution Guide before opening a PR.
81 followers · starred Mar 2026