Lyo.Images
1.0.2
dotnet add package Lyo.Images --version 1.0.2
NuGet\Install-Package Lyo.Images -Version 1.0.2
<PackageReference Include="Lyo.Images" Version="1.0.2" />
<PackageVersion Include="Lyo.Images" Version="1.0.2" />
<PackageReference Include="Lyo.Images" />
paket add Lyo.Images --version 1.0.2
#r "nuget: Lyo.Images, 1.0.2"
#:package Lyo.Images@1.0.2
#addin nuget:?package=Lyo.Images&version=1.0.2
#tool nuget:?package=Lyo.Images&version=1.0.2
Lyo.Images
Production-ready raster image processing for .NET using SixLabors.ImageSharp. Implements IImageService (resize, crop, rotate, watermark, format conversion, thumbnails, compression, metadata, palette extraction, batch processing) plus a generic image-decoration surface (IImageDecorationService): centered/positioned overlay compositing (raster + SVG), stroked frame outlines, caption bands, and outer padding/shadow — all stream-based and chainable through IImageDecorationPipeline.
Features
- Resize — Max, Crop, Pad, BoxPad, Stretch (
ResizeMode). - Crop, Rotate, Watermark, Convert format, Thumbnail, Compress.
- Metadata — Dimensions, format, optional EXIF (device, GPS, date taken) via ImageSharp.
- Palette — Dominant colors (
GetPaletteAsync); optional ignore of transparent pixels (ImageServiceOptions). - Batch —
ProcessBatchAsyncwithImageProcessRequest/ImageOperationsubclasses. - Decoration primitives —
OverlayAsync(raster center/positioned pad + stroke; SVG documents get a base64 PNG<image>spliced before</svg>),AddFrameAsync(stroked outline with optional rounded corners + fill),AddCaptionAsync(header/footer band, optional notch + rounded outside corners),AddOuterPaddingAsync(rounded card + canvas margin + optional drop shadow). Each accepts aStreamin/out and anImageFormat?. The pipeline (IImageDecorationPipeline) chains them without intermediate streams. - Thread-safe, async, logging/metrics, cancellation.
Examples
Quick start
using Lyo.Images;
using Lyo.Images.Builders;
using Lyo.Common.Enums;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddImageSharpImageService(o => o.DefaultQuality = 90);
var sp = services.BuildServiceProvider();
var images = sp.GetRequiredService<IImageService>();
await using var input = File.OpenRead("photo.jpg");
await using var output = File.Create("photo-800.jpg");
await images.ResizeAsync(input, output, 800, 600, ResizeMode.Max, ImageFormat.Jpeg, quality: 90);
Build a QR badge by chaining decoration primitives
using Lyo.Images;
using Lyo.Images.Builders;
using Lyo.Common.Enums;
var decoration = sp.GetRequiredService<IImageDecorationService>();
var qrBytes = File.ReadAllBytes("qr.png");
var logoBytes = File.ReadAllBytes("logo.png");
var result = await decoration.Pipeline(qrBytes)
.Overlay(logoBytes, b => b
.WithOverlaySizePercent(18)
.WithPadColor("#FFFFFF")
.WithBorder("#000000"))
.AddCaption(b => b
.WithText("Scan Me")
.WithBackgroundColor("#1e293b")
.WithTextColor("#FFFFFF")
.WithNotch())
.AddOuterPadding(b => b
.WithPanelColor("#FFFFFF")
.WithCornerRadius(16)
.WithShadow("#33000000", offsetPx: 6))
.AddFrame(b => b
.WithStrokeColor("#1e293b")
.WithStrokeWidth(2)
.WithCornerRadius(16))
.ToByteArrayAsync(ImageFormat.Png);
File.WriteAllBytes("qr-badge.png", result.Data!);
Public API overview
| Type | Description |
|---|---|
IImageService / ImageSharpImageService / ImageServiceBase |
Primary façade for stream-based image operations and file helpers; ImageSharp backend with full EXIF. |
IImageDecorationService / ImageDecorationService |
Generic decoration primitives: OverlayAsync, AddFrameAsync, AddCaptionAsync, AddOuterPaddingAsync. IImageService inherits this interface. |
IImageDecorationPipeline (via IImageDecorationService.Pipeline(byte[]/Stream)) |
Fluent chain of primitives that keeps a single in-memory image between stages. |
OverlayOptionsBuilder / FrameOptionsBuilder / CaptionOptionsBuilder / PaddingOptionsBuilder |
Fluent option builders under Lyo.Images.Builders; also exposed as configurator overloads on the pipeline (e.g. pipeline.AddFrame(b => b.WithStrokeWidth(2))). |
ISpriteSheetExportService / SpriteSheetExportService |
Spritesheet export, frame crops, animated GIF helpers (Lyo.Images.Sprite). |
Extensions |
DI registration: AddImageSharpImageService (options/action/IConfiguration overloads), AddSpriteSheetExportService. |
AddImageSharpImageService also registers IImageDecorationService if not already present, so consumers that resolve only the decoration interface still work.
Public API overview — Namespaces
Lyo.Images— services, pipeline, DI extensions, error codes.Lyo.Images.Models—ImageServiceOptions,ImageProcessRequest,WatermarkOptions,OverlayOptions/OverlayPosition,FrameOptions,CaptionOptions/CaptionPlacement,PaddingOptions,ImageMetadata, enums such asResizeModeandWatermarkPosition.Lyo.Images.Builders— fluent builders for the option types plus pipeline-builder extensions.Lyo.Images.Decoration— internal per-primitive drawers (OverlayDrawer,FrameDrawer,CaptionDrawer,OuterPaddingDrawer) backingImageDecorationService.Lyo.Images.Sprite/Lyo.Images.Sprite.Models— spritesheet pipeline types.
Build a QR badge by chaining decoration primitives
Stages run in the queued order. SVG input is supported by Overlay; the other primitives require raster input and throw NotSupportedException if the pipeline state is SVG.
Production readiness
- Thread-safe service usage; validate streams and options per implementation.
- Streaming-friendly APIs; size limits enforced via
ImageServiceOptions. - Optional metrics histograms (see
Lyo.Images.Constants.Metrics).
Related image libraries
Lyo.Images.Ocr— OCR abstractions and models.Lyo.Images.OpenCv— OpenCvSharp Telea inpaint on PNG ROI buffers (optional native runtime).
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Common— (direct, lyo)Lyo.Exceptions— (direct, lyo)Lyo.Metrics— (direct, lyo)Lyo.Result— (direct, lyo)Microsoft.Extensions.Configuration.Binder10.0.5— (direct, microsoft)Microsoft.Extensions.DependencyInjection.Abstractions10.0.5— (direct, microsoft)Microsoft.Extensions.Logging.Abstractions10.0.5— (direct, microsoft)SixLabors.Fonts2.1.3— (direct, third-party)SixLabors.ImageSharp3.1.12— (direct, third-party)SixLabors.ImageSharp.Drawing2.1.7— (direct, third-party)Microsoft.Extensions.Options.ConfigurationExtensions10.0.5— (transitive, microsoft)System.Memory4.6.3— (transitive, microsoft, netstandard2.0)System.Text.Json10.0.5— (transitive, microsoft, netstandard2.0)
| Product | Versions 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. |
-
net10.0
- Lyo.Common (>= 1.0.2)
- Lyo.Exceptions (>= 1.0.2)
- Lyo.Metrics (>= 1.0.2)
- Lyo.Result (>= 1.0.2)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- SixLabors.Fonts (>= 2.1.3)
- SixLabors.ImageSharp (>= 3.1.12)
- SixLabors.ImageSharp.Drawing (>= 2.1.7)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Lyo.Images:
| Package | Downloads |
|---|---|
|
Lyo.Images.Web.Components
Reusable Blazor components for image workbenches, sprite animation, and spritesheet extraction. |
|
|
Lyo.Images.Skia
Image processing library for .NET using SkiaSharp with support for resize, crop, rotate, watermark, and format conversion. |
|
|
Lyo.QRCode.Web.Components
Reusable Blazor components for QR code generation and preview workflows. |
GitHub repositories
This package is not used by any popular GitHub repositories.