### Install Azure Blob Storage Provider for ImageSharp.Web
Source: https://docs.sixlabors.com/articles/imagesharp.web/imagecaches.html
Install the Azure provider package using the .NET CLI.
```bash
dotnet add package SixLabors.ImageSharp.Web.Providers.Azure
```
--------------------------------
### Install WebGPU Package (PackageReference)
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/webgpu.html
Include this PackageReference in your project file to install the WebGPU package.
```xml
__
```
--------------------------------
### Install WebGPU Package (Package Manager)
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/webgpu.html
Use this command in the Package Manager Console to install the WebGPU package.
```powershell
PM > Install-Package SixLabors.ImageSharp.Drawing.WebGPU -Version VERSION_NUMBER
__
```
--------------------------------
### Install WebGPU Package (.NET CLI)
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/webgpu.html
Use the .NET CLI to add the WebGPU package to your project.
```bash
dotnet add package SixLabors.ImageSharp.Drawing.WebGPU --version VERSION_NUMBER
__
```
--------------------------------
### Install AWS S3 Provider for ImageSharp.Web
Source: https://docs.sixlabors.com/articles/imagesharp.web/imagecaches.html
Install the AWS provider package using the .NET CLI.
```bash
dotnet add package SixLabors.ImageSharp.Web.Providers.AWS
```
--------------------------------
### Install WebGPU Package (Paket CLI)
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/webgpu.html
Use the Paket CLI to add the WebGPU package to your project.
```bash
paket add SixLabors.ImageSharp.Drawing.WebGPU --version VERSION_NUMBER
__
```
--------------------------------
### Install ImageSharp.Web via Paket CLI
Source: https://docs.sixlabors.com/articles/imagesharp.web/index.html
Use this command with the Paket CLI to add the ImageSharp.Web NuGet package to your project.
```bash
paket add SixLabors.ImageSharp.Web --version VERSION_NUMBER
```
--------------------------------
### Install ImageSharp.Web via .NET CLI
Source: https://docs.sixlabors.com/articles/imagesharp.web/index.html
Use this command in your terminal to add the ImageSharp.Web NuGet package to your project.
```bash
dotnet add package SixLabors.ImageSharp.Web --version VERSION_NUMBER
```
--------------------------------
### Install SixLabors.Fonts via Paket CLI
Source: https://docs.sixlabors.com/articles/fonts/index.html
Use this command with the Paket package manager to install the library.
```bash
paket add SixLabors.Fonts --version VERSION_NUMBER
```
--------------------------------
### Example Image Processing Requests
Source: https://docs.sixlabors.com/articles/imagesharp.web/gettingstarted.html
These examples demonstrate how to use query string parameters to process images with ImageSharp.Web, such as resizing, cropping, changing format, and adjusting quality.
```url
/images/photo.jpg?width=400
```
```url
/images/photo.jpg?width=400&height=250&rmode=crop
```
```url
/images/logo.png?bgcolor=white&format=jpg&quality=85
```
--------------------------------
### Install ImageSharp.Web via Package Manager Console
Source: https://docs.sixlabors.com/articles/imagesharp.web/index.html
Use this command in the Package Manager Console in Visual Studio to install the ImageSharp.Web NuGet package.
```powershell
PM > Install-Package SixLabors.ImageSharp.Web -Version VERSION_NUMBER
```
--------------------------------
### Install ImageSharp using Package Manager Console
Source: https://docs.sixlabors.com/articles/imagesharp/index.html
Use this command in the Package Manager Console in Visual Studio to install ImageSharp.
```powershell
PM > Install-Package SixLabors.ImageSharp -Version VERSION_NUMBER
__
```
--------------------------------
### Install PolygonClipper via Paket CLI
Source: https://docs.sixlabors.com/articles/polygonclipper/index.html
Use this command with the Paket CLI to add the PolygonClipper NuGet package.
```bash
paket add SixLabors.PolygonClipper --version VERSION_NUMBER
```
--------------------------------
### Initialize TextOptions with Core Units
Source: https://docs.sixlabors.com/articles/fonts/textlayout.html
Sets up basic text layout properties like DPI, origin, and wrapping length. Ensure the font family is installed on your system.
```csharp
using System.Numerics;
using SixLabors.Fonts;
Font font = SystemFonts.CreateFont("Segoe UI", 18);
TextOptions options = new(font)
{
Dpi = 96,
Origin = new Vector2(20, 40),
WrappingLength = 480
};
```
--------------------------------
### Install PolygonClipper via .NET CLI
Source: https://docs.sixlabors.com/articles/polygonclipper/index.html
Use this .NET CLI command to add the PolygonClipper NuGet package to your project.
```bash
dotnet add package SixLabors.PolygonClipper --version VERSION_NUMBER
```
--------------------------------
### Install ImageSharp using PackageReference
Source: https://docs.sixlabors.com/articles/imagesharp/index.html
Add this XML element to your project file to reference the ImageSharp package.
```xml
__
```
--------------------------------
### Install ImageSharp using .NET CLI
Source: https://docs.sixlabors.com/articles/imagesharp/index.html
Use this command in the .NET CLI to add the ImageSharp package to your project.
```bash
dotnet add package SixLabors.ImageSharp --version VERSION_NUMBER
__
```
--------------------------------
### Install PolygonClipper via Package Manager
Source: https://docs.sixlabors.com/articles/polygonclipper/index.html
Use this command in the Package Manager Console to install the PolygonClipper NuGet package.
```powershell
PM > Install-Package SixLabors.PolygonClipper -Version VERSION_NUMBER
```
--------------------------------
### Install Pixels in SkiaSharp
Source: https://docs.sixlabors.com/articles/imagesharp/migratingfromskiasharp.html
Installs raw pixel data into a SkiaSharp SKBitmap. Ensure the SKImageInfo matches the pixel data.
```csharp
using SkiaSharp;
SKImageInfo info = new(320, 200, SKColorType.Rgba8888, SKAlphaType.Unpremul);
using SKBitmap bitmap = new();
bitmap.InstallPixels(info, pixels, info.RowBytes);
__
```
--------------------------------
### Install ImageSharp.Drawing via Paket CLI
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/index.html
Use the Paket CLI command to add the ImageSharp.Drawing NuGet package to your project.
```bash
paket add SixLabors.ImageSharp.Drawing --version VERSION_NUMBER
```
--------------------------------
### Install ImageSharp.Drawing via PackageReference
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/index.html
Include this XML snippet in your project file to reference the ImageSharp.Drawing NuGet package.
```xml
```
--------------------------------
### Install ImageSharp.Drawing via .NET CLI
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/index.html
Use the .NET CLI command to add the ImageSharp.Drawing NuGet package to your project.
```bash
dotnet add package SixLabors.ImageSharp.Drawing --version VERSION_NUMBER
```
--------------------------------
### Install ImageSharp using Paket CLI
Source: https://docs.sixlabors.com/articles/imagesharp/index.html
Use this command with the Paket CLI to add ImageSharp to your project dependencies.
```bash
paket add SixLabors.ImageSharp --version VERSION_NUMBER
__
```
--------------------------------
### Install ImageSharp.Web via PackageReference
Source: https://docs.sixlabors.com/articles/imagesharp.web/index.html
Add this XML element to your project file's PropertyGroup to include the ImageSharp.Web NuGet package.
```xml
```
--------------------------------
### Install PolygonClipper via PackageReference
Source: https://docs.sixlabors.com/articles/polygonclipper/index.html
Add this entry to your project file's ItemGroup to include the PolygonClipper NuGet package.
```xml
```
--------------------------------
### Install SixLabors.Fonts via .NET CLI
Source: https://docs.sixlabors.com/articles/fonts/index.html
Use this command in your terminal to add the library as a project dependency.
```bash
dotnet add package SixLabors.Fonts --version VERSION_NUMBER
```
--------------------------------
### Render Text Using Custom Renderer
Source: https://docs.sixlabors.com/articles/fonts/customrendering.html
Demonstrates how to use `TextRenderer.RenderTextTo` with a custom `IGlyphRenderer` implementation. Ensure the specified font is installed on your system.
```csharp
using SixLabors.Fonts;
using SixLabors.Fonts.Rendering;
Font font = SystemFonts.CreateFont("Segoe UI", 18);
TextOptions options = new(font)
{
ColorFontSupport = ColorFontSupport.ColrV1 | ColorFontSupport.Svg
};
RecordingGlyphRenderer renderer = new();
TextRenderer.RenderTextTo(renderer, "Hello world", options);
```
--------------------------------
### Creating a Graphics Object from a Bitmap (System.Drawing)
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/migratingfromsystemdrawing.html
In System.Drawing, drawing typically starts by creating a Graphics object from a Bitmap. This snippet shows the setup for drawing operations.
```csharp
using System.Drawing;
using Bitmap bitmap = new(420, 240);
using Graphics graphics = Graphics.FromImage(bitmap);
using SolidBrush brush = new(Color.CornflowerBlue);
graphics.Clear(Color.White);
graphics.FillRectangle(brush, new Rectangle(40, 40, 260, 110));
__
```
--------------------------------
### Get Caret Position at Start or End
Source: https://docs.sixlabors.com/articles/fonts/texthittesting.html
Initializes a CaretPosition without a pointer hit, typically used when an editor is first opened. Use CaretPlacement.Start or CaretPlacement.End to set the initial caret location.
```csharp
using SixLabors.Fonts;
CaretPosition start = metrics.GetCaret(CaretPlacement.Start);
CaretPosition end = metrics.GetCaret(CaretPlacement.End);
```
--------------------------------
### Creating and Using Image and Pattern Brushes
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/brushesandpens.html
Demonstrates creating a tile image, an ImageBrush from the tile, and a PatternBrush with a custom matrix. It then applies these brushes to fill rectangular areas of a target image.
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using Image tile = new(24, 24, Color.Transparent.ToPixel());
tile.Mutate(ctx => ctx.Paint(canvas =>
{
canvas.Fill(Brushes.Solid(Color.LightYellow));
canvas.DrawLine(Pens.Solid(Color.DarkGoldenrod, 3), new PointF(0, 24), new PointF(24, 0));
}));
using Image image = new(420, 220, Color.White.ToPixel());
ImageBrush imageBrush = new(tile, new RectangleF(0, 0, 24, 24), new Point(0, 0));
PatternBrush matrixBrush = new(
Color.DarkSlateGray.WithAlpha(0.75F),
Color.Transparent,
new bool[,]
{
{ true, false, false, false },
{ false, true, false, false },
{ false, false, true, false },
{ false, false, false, true }
});
image.Mutate(ctx => ctx.Paint(canvas =>
{
canvas.Fill(imageBrush, new Rectangle(28, 28, 160, 132));
canvas.Fill(matrixBrush, new Rectangle(232, 28, 160, 132));
}));
```
--------------------------------
### Configure WebGPU Options
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/webgpuenvironment.html
Set the PowerPreference for the WebGPU adapter. This should be done once during application startup before any WebGPU objects are created.
```csharp
using SixLabors.ImageSharp.Drawing.Processing.Backends;
WebGPUEnvironment.Options = new()
{
PowerPreference = WebGPUPowerPreference.HighPerformance
};
```
--------------------------------
### Render with Run (Basic)
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/webgpuwindow.html
Use the `Run` method for simple rendering where the window manages the frame acquisition and disposal. This is suitable for straightforward drawing tasks.
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.Drawing.Processing.Backends;
using WebGPUWindow window = new(new WebGPUWindowOptions { Title = "WebGPU Demo" });
window.Run((WebGPUSurfaceFrame frame) =>
{
DrawingCanvas canvas = frame.Canvas;
Rectangle panel = new(64, 72, 320, 180);
// The frame is presented after Run disposes it at the end of the callback.
canvas.Clear(Brushes.Solid(Color.White));
canvas.Fill(Brushes.Solid(Color.CornflowerBlue), panel);
canvas.FillEllipse(Brushes.Solid(Color.Gold), new(224, 162), new(120, 82));
canvas.Draw(Pens.Solid(Color.Black, 3), panel);
});
```
--------------------------------
### Install ImageSharp.Drawing via Package Manager
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/index.html
Use this command in the Package Manager Console to install the ImageSharp.Drawing NuGet package.
```powershell
PM > Install-Package SixLabors.ImageSharp.Drawing -Version VERSION_NUMBER
```
--------------------------------
### Create and Draw Open and Closed Paths
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/pathsandshapes.html
Demonstrates creating an open cubic bezier path and a closed polygon path. Shows how to draw the open path with a pen and fill/draw the closed path.
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using Image image = new(440, 220, Color.White.ToPixel());
PathBuilder openBuilder = new();
openBuilder.AddCubicBezier(
new(36, 152),
new(116, 34),
new(252, 38),
new(396, 154));
IPath openPath = openBuilder.Build();
PathBuilder closedBuilder = new();
closedBuilder.AddLines(new(64, 174), new(154, 54), new(244, 174));
closedBuilder.CloseFigure();
IPath closedPath = closedBuilder.Build();
image.Mutate(ctx => ctx.Paint(canvas =>
{
canvas.Draw(Pens.Solid(Color.MidnightBlue, 8), openPath);
// Closed figures can be filled because they define an inside area.
canvas.Fill(Brushes.Solid(Color.Gold.WithAlpha(0.6F)), closedPath);
canvas.Draw(Pens.Solid(Color.DarkGoldenrod, 4), closedPath);
}));
```
--------------------------------
### Create a WebGPU Window
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/webgpuwindow.html
Demonstrates how to create a WebGPUWindow with specified options for title, size, present mode, and texture format. Use this when ImageSharp.Drawing should own the application window.
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.Drawing.Processing.Backends;
WebGPUWindowOptions options = new()
{
Title = "ImageSharp.Drawing WebGPU",
Size = new(960, 540),
PresentMode = WebGPUPresentMode.Fifo,
Format = WebGPUTextureFormat.Rgba8Unorm
};
using WebGPUWindow window = new(options);
```
--------------------------------
### Install SixLabors.Fonts via Package Manager Console
Source: https://docs.sixlabors.com/articles/fonts/index.html
Use this command in the Package Manager Console in Visual Studio to install the library.
```powershell
PM > Install-Package SixLabors.Fonts -Version VERSION_NUMBER
```
--------------------------------
### Get FontMetrics from a FontFamily
Source: https://docs.sixlabors.com/articles/fonts/fontmetrics.html
Inspect available font faces on a family to get FontMetrics before creating a Font instance. This is useful for pre-checking font properties.
```csharp
using System;
using SixLabors.Fonts;
FontCollection collection = new();
FontFamily family = collection.Add("fonts/SourceSans3-Regular.ttf");
if (family.TryGetMetrics(FontStyle.Regular, out FontMetrics? metrics))
{
Console.WriteLine(metrics.Description.FontNameInvariantCulture);
}
```
--------------------------------
### Create Win32 Surface Host
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/webgpuexternalsurface.html
Create a WebGPUSurfaceHost for Win32 applications using the hwnd and hinstance.
```csharp
using SixLabors.ImageSharp.Drawing.Processing.Backends;
WebGPUSurfaceHost host = WebGPUSurfaceHost.Win32(hwnd, hinstance);
```
--------------------------------
### Draw Prepared Text with TextBlock
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/text.html
Demonstrates how to prepare text layout using TextBlock, measure its metrics, and draw it onto an image. Use this when the same text needs to be measured, wrapped, or drawn multiple times.
```csharp
using SixLabors.Fonts;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using Image image = new(640, 260, Color.White.ToPixel());
Font font = SystemFonts.CreateFont("Arial", 32);
RichTextOptions options = new(font)
{
Origin = new(0, 0),
HorizontalAlignment = HorizontalAlignment.Center,
LineSpacing = 1.15F
};
TextBlock block = new("Prepared text can be measured and drawn with the same shaping.", options);
TextMetrics metrics = block.Measure(wrappingLength: 520);
Rectangle layoutBox = new(60, 48, 520, (int)MathF.Ceiling(metrics.Advance.Height + 24));
image.Mutate(ctx => ctx.Paint(canvas =>
{
// TextBlock owns shaping and text options; DrawText supplies canvas placement and wrapping.
canvas.Draw(Pens.Solid(Color.LightGray, 1), layoutBox);
canvas.DrawText(block, new PointF(60, 60), 520, Brushes.Solid(Color.DarkSlateBlue), pen: null);
}));
```
--------------------------------
### Get Bounding Box and Translate Polygon
Source: https://docs.sixlabors.com/articles/polygonclipper/polygonsandcontours.html
Demonstrates how to get the bounding box of a polygon and then translate the polygon by a specified offset. Useful for staging input or culling broad regions.
```csharp
using SixLabors.PolygonClipper;
Box2 bounds = polygon.GetBoundingBox();
polygon.Translate(10, 20);
```
--------------------------------
### Measure Lines and Get Line Metrics
Source: https://docs.sixlabors.com/articles/fonts/measuringtext.html
Use `CountLines` to get the number of lines and `GetLineMetrics` to retrieve detailed metrics for each line, including ascender, baseline, descender, and line height. Ensure `TextOptions` are configured with `WrappingLength` for wrapped text.
```csharp
using System;
using SixLabors.Fonts;
Font font = SystemFonts.CreateFont("Segoe UI", 18);
TextOptions options = new(font)
{
WrappingLength = 320
};
int lineCount = TextMeasurer.CountLines("Hello world from Fonts", options);
ReadOnlyMemory lines = TextMeasurer.GetLineMetrics("Hello world from Fonts", options);
```
--------------------------------
### Minimal ASP.NET Core Setup
Source: https://docs.sixlabors.com/articles/imagesharp.web/gettingstarted.html
This snippet shows the essential services and middleware to register for ImageSharp.Web. Ensure `UseImageSharp()` is placed before `UseStaticFiles()` to allow ImageSharp.Web to intercept image requests.
```csharp
using SixLabors.ImageSharp.Web;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddImageSharp();
WebApplication app = builder.Build();
app.UseImageSharp();
app.UseStaticFiles();
app.Run();
```
--------------------------------
### Configure License Key from Environment Variable
Source: https://docs.sixlabors.com/articles/fonts/index.html
Set the license key directly from an environment variable in your project file.
```xml
$(SIXLABORS_LICENSE_KEY)
```
--------------------------------
### Create WebGPU External Surface
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/webgpuexternalsurface.html
Instantiate WebGPUExternalSurface with a host, size, and presentation options. Ensure the host and native handles remain valid for the lifetime of the surface.
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing.Processing.Backends;
WebGPUExternalSurfaceOptions options = new()
{
PresentMode = WebGPUPresentMode.Fifo,
Format = WebGPUTextureFormat.Rgba8Unorm
};
using WebGPUExternalSurface surface = new(host, new Size(1280, 720), options);
```
--------------------------------
### Image Initialization: SkiaSharp vs. ImageSharp
Source: https://docs.sixlabors.com/articles/imagesharp/migratingfromskiasharp.html
Shows how to initialize an image with specific dimensions and pixel formats. ImageSharp uses generic types for explicit pixel format control.
```csharp
using SkiaSharp;
SKImageInfo info = new(640, 360, SKColorType.Rgba8888, SKAlphaType.Unpremul);
using SKBitmap bitmap = new(info);
__
```
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.PixelFormats;
using Image image = new(640, 360);
__
```
--------------------------------
### ImageSharp Load, Resize, and Save
Source: https://docs.sixlabors.com/articles/imagesharp/migratingfromskiasharp.html
Illustrates the equivalent ImageSharp workflow for loading an image, resizing it in-place, and saving it as a PNG.
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using Image image = Image.Load("input.jpg");
image.Mutate(context => context.Resize(400, 300));
image.SaveAsPng("output.png");
```
--------------------------------
### Build with License Key via Bash
Source: https://docs.sixlabors.com/articles/fonts/index.html
Pass the license key to the dotnet build command using a Bash environment variable.
```bash
dotnet build -p:SixLaborsLicenseKey="$SIXLABORS_LICENSE_KEY"
dotnet publish -p:SixLaborsLicenseKey="$SIXLABORS_LICENSE_KEY"
```
--------------------------------
### Drawing with Pattern Brushes and Pens
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/brushesandpens.html
Demonstrates the use of pattern brushes for filling areas and various predefined pens (dash, dot, dash-dot) for drawing shapes and lines. Requires ImageSharp and ImageSharp.Drawing namespaces.
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using Image image = new(420, 240, Color.White.ToPixel());
Brush hatchBrush = Brushes.ForwardDiagonal(Color.DarkSlateGray.WithAlpha(0.72F), Color.Transparent);
Pen dashPen = Pens.Dash(Color.MidnightBlue, 5);
Pen dotPen = Pens.Dot(Color.Crimson, 4);
Pen dashDotPen = Pens.DashDot(Color.Black, 3);
image.Mutate(ctx => ctx.Paint(canvas =>
{
Rectangle hatchArea = new(28, 28, 160, 138);
canvas.Fill(hatchBrush, hatchArea);
canvas.Draw(dashPen, hatchArea);
canvas.DrawEllipse(dotPen, new(292, 96), new(170, 92));
canvas.DrawLine(dashDotPen, new(38, 206), new(150, 178), new(264, 210), new(382, 172));
}));
```
--------------------------------
### SkiaSharp Load, Resize, and Save
Source: https://docs.sixlabors.com/articles/imagesharp/migratingfromskiasharp.html
Demonstrates the SkiaSharp workflow for decoding an image, resizing it, and encoding it as a PNG.
```csharp
using SkiaSharp;
using SKBitmap source = SKBitmap.Decode("input.jpg");
using SKBitmap output = source.Resize(new SKImageInfo(400, 300), SKFilterQuality.High);
using SKImage image = SKImage.FromBitmap(output);
using SKData data = image.Encode(SKEncodedImageFormat.Png, 100);
using FileStream stream = File.OpenWrite("output.png");
data.SaveTo(stream);
```
--------------------------------
### List Installed Font Families
Source: https://docs.sixlabors.com/articles/fonts/listsystemfonts.html
Iterates through all available font families on the system and prints their names to the console. Useful for diagnostics.
```csharp
using System;
using SixLabors.Fonts;
foreach (FontFamily family in SystemFonts.Families)
{
Console.WriteLine(family.Name);
}
```
--------------------------------
### Get GIF Metadata
Source: https://docs.sixlabors.com/articles/imagesharp/gif.html
Use GetGifMetadata() to access GIF-level metadata from an image. This includes properties like RepeatCount and ColorTableMode.
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Formats.Gif;
using Image image = Image.Load("input.gif");
GifMetadata gifMetadata = image.Metadata.GetGifMetadata();
```
--------------------------------
### Create and Use Linear and Radial Gradient Brushes
Source: https://docs.sixlabors.com/articles/imagesharp.drawing/brushesandpens.html
Demonstrates the creation and application of both linear and radial gradient brushes. Use this when you need to fill shapes with smooth color transitions. Ensure you have the necessary ImageSharp.Drawing and ImageSharp.Processing namespaces imported.
```csharp
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using Image image = new(420, 240, Color.White.ToPixel());
LinearGradientBrush linear = new(
new(24, 24),
new(220, 150),
GradientRepetitionMode.None,
new(0F, Color.LightYellow),
new(0.5F, Color.DeepSkyBlue),
new(1F, Color.MediumBlue));
RadialGradientBrush radial = new(
new(306, 116),
82F,
GradientRepetitionMode.Reflect,
new(0F, Color.Orange),
new(1F, Color.MediumVioletRed.WithAlpha(0.25F)));
image.Mutate(ctx => ctx.Paint(canvas =>
{
canvas.Fill(linear, new Rectangle(24, 24, 190, 132));
canvas.FillEllipse(radial, new(306, 116), new(156, 112));
}));
```