Bit.Bmage
10.7.0-pre-03
See the version list below for details.
dotnet add package Bit.Bmage --version 10.7.0-pre-03
NuGet\Install-Package Bit.Bmage -Version 10.7.0-pre-03
<PackageReference Include="Bit.Bmage" Version="10.7.0-pre-03" />
<PackageVersion Include="Bit.Bmage" Version="10.7.0-pre-03" />
<PackageReference Include="Bit.Bmage" />
paket add Bit.Bmage --version 10.7.0-pre-03
#r "nuget: Bit.Bmage, 10.7.0-pre-03"
#:package Bit.Bmage@10.7.0-pre-03
#addin nuget:?package=Bit.Bmage&version=10.7.0-pre-03&prerelease
#tool nuget:?package=Bit.Bmage&version=10.7.0-pre-03&prerelease
bit Bmage
Browser-side image processing for Blazor. Load, transform, annotate and export images entirely on the user's device, from strongly typed C#.
No server round trips. No base64. No JavaScript image library.
var result = await processor.ProcessAsync(
uploadedFile,
ImagePipeline.Create()
.AutoOrient()
.Cover(512, 512)
.Sharpen(0.3f),
new ImageExportOptions
{
Format = ImageFormat.WebP,
Quality = 0.82,
Metadata = MetadataPolicy.StripSensitive,
MaxFileSize = 120 * 1024,
});
That runs in the browser. The original file never leaves it, the phone's rotation is applied, the GPS coordinates are stripped, and the result is a WebP that fits the size budget you asked for.
Targets .NET 8, 9, and 10 · Everything works on Blazor WebAssembly and Interactive Auto once interactive. Interactive Server works too: PNG, JPEG, BMP and GIF are coded on the server, while WebP, AVIF and editor previews cross the circuit. Prerendering, ASP.NET Core and console hosts get the headless API with the managed codecs.
Bmage's documentation website lives in Demo - run the
Demo/Server project, or visit bmage.bitplatform.dev.
Table of Contents
- Why Bmage
- Packages
- Installation
- The simple path
- The full editor
- What is in the box
- Performance
- Where it runs
- MCP server (for AI agents)
- Tests
- Documentation
- License
Why Bmage
Blazor developers who need to crop an avatar or shrink an upload have had two options: send the full-resolution file to a server, or assemble several JavaScript libraries behind hand-written interop. Bmage is a third option: one coherent, Blazor-native image processing platform where the engine itself is C#.
- Non-destructive by construction. An edit is a list of operations, not a mutated buffer. Undo costs a few hundred bytes, previews are cheap, and any earlier step can be changed without redoing the rest.
- The engine is this project. The resampler, rasteriser, colour pipeline, TrueType text engine, and the PNG, JPEG, BMP and GIF codecs are implemented here. The browser is used only for what only it can do: WebP and AVIF.
- Large images stay usable. Interactive editing runs on a proxy sized for the display and replays at full resolution on export, so a 24 megapixel photo does not stall the interface.
- Privacy is the default. Metadata is removed unless you ask for it. Location data cannot leak into an exported avatar by accident.
- Nothing about the browser is assumed. Format support is probed by actually encoding a pixel. When a browser substitutes PNG for the AVIF you requested, you get an exception, not a silent surprise.
- Headless first. Every capability works without the editor component, so the same pipeline runs in an upload handler or a console tool.
Packages
| Package | What it contains | Depends on |
|---|---|---|
Bit.Bmage |
The engine, browser codecs, capabilities, loading and export, headless processing on a server, and the BmageEditor / BmageDropZone components |
Microsoft.AspNetCore.Components.Web |
Everything ships in the one package. The editor's stylesheet is opt-in, so an app that brings its own UI or only processes images headlessly never loads it.
Installation
dotnet add package Bit.Bmage
Register the services in Program.cs:
using Bit.Bmage;
builder.Services.AddBitBmageServices();
For server-side or console use, without any browser integration, register AddBitBmageHeadlessServices() instead.
A WebAssembly app whose only use of Bmage is BmageEditor can skip the registration and lazy load Bit.Bmage.wasm
instead; see lazy loading.
Add the stylesheet if you use the editor:
<link rel="stylesheet" href="_content/Bit.Bmage/bit-bmage-editor.css" />
In the browser, consider AOT compilation in the project that runs on WebAssembly. Bmage is tuned for the default interpreter, where the editor opens a 12 megapixel photo in about 50 ms, but work that stays in .NET still runs 4 to 12× faster compiled ahead of time:
<RunAOTCompilation>true</RunAOTCompilation>
The simple path
@inject ImageLoader Loader
@inject ImageExporter Exporter
<InputFile OnChange="OnChange" accept="image/*" />
@code {
async Task OnChange(InputFileChangeEventArgs e)
{
using var image = await Loader.LoadAsync(e.File);
using var thumb = await ImagePipeline.Create()
.AutoOrient()
.MaxSize(400, 400)
.ExecuteAsync(image);
await Exporter.DownloadAsync(thumb, "thumbnail",
new ImageExportOptions { Format = ImageFormat.WebP, Quality = 0.85 });
}
}
The full editor
@using Bit.Bmage.Editor.Components
<BmageEditor @ref="editor" />
<button @onclick="() => editor.DownloadAsync("edited")">Save</button>
Crop, rotate, adjustments, filters, drawing, annotations, redaction, layers, history and export, in one component. It is themeable through CSS custom properties, fully localisable, keyboard accessible, touch friendly and right-to-left aware. Every part of its UI can be replaced while keeping the engine:
<BmageEditor Strings="german" Direction="rtl" Class="bmg-theme-dark">
<Toolbar Context="editor">
<button @onclick="() => editor.SetTool(EditorToolKind.Crop)">Crop</button>
<button disabled="@(!editor.CanUndo)" @onclick="editor.Undo">Undo</button>
</Toolbar>
</BmageEditor>
What is in the box
| Area | What you get |
|---|---|
| Loading | IBrowserFile, byte arrays, streams, data URLs, object URLs, remote URLs, clipboard, drag and drop, camera |
| Decoding | PNG, JPEG, BMP and GIF in managed code; PNG, JPEG, WebP, AVIF and GIF through the browser |
| Encoding | PNG, JPEG and BMP in managed code; PNG, JPEG, WebP and AVIF through the browser |
| Transforms | Crop, aspect crop, resize in six modes, rotate, flip, skew, affine and perspective warps |
| Adjustments | Brightness, contrast, saturation, hue, exposure, gamma, levels, temperature, tint, vibrance, shadows, highlights, opacity |
| Filters | Grayscale, sepia, invert, posterize, threshold, blur, sharpen, pixelate, noise, median denoise, vignette, custom convolution and colour matrices |
| Analysis | Histograms, luminance statistics, dominant colour palettes, auto-levels, auto-contrast, saliency-based smart cropping, low-quality placeholders |
| Drawing | Anti-aliased paths, strokes with caps, joins and dashes, gradients, ellipses, polygons, arrows, freehand, text |
| Annotations | Rectangle, ellipse, line, arrow, freehand, polygon, text, highlight, callout, numbered step, image stamp, redaction |
| Metadata | EXIF read and write, GPS, camera data, orientation, ICC profiles, XMP, three privacy policies |
| Pipelines | Composition, optimisation, lazy execution, cancellation, progress, batch processing |
| Editing | Non-destructive documents, undo and redo, memory-aware history, proxy previews |
Performance
Every number below was measured with BenchmarkDotNet on desktop .NET 10 (see
Tests/Bit.Bmage.Benchmarks). In the browser, with RunAOTCompilation enabled,
WebAssembly lands within about 2.5× of these numbers, and the default interpreter is 4 to 12× slower than that; the WebAssembly
table in performance.md has both. See
docs/performance.md for the full tables and how to reproduce them.
| Operation | Image | Time | Allocated |
|---|---|---|---|
| Thumbnail to 200px | 6000 × 4000 | 23 ms | 23 KB |
| Downscale to 1280px, Lanczos | 3840 × 2160 | 40 ms | 180 KB |
| Upload pipeline: orient, cap at 1920, sharpen | 4000 × 3000 | 101 ms | 238 KB |
| Four adjustments fused into one pass | 3840 × 2160 | 67 ms | 4.6 KB |
| JPEG encode, quality 85 | 3840 × 2160 | 122 ms | 6.7 MB |
| PNG decode | 3840 × 2160 | 88 ms | 37 MB |
Where it runs
| Host | Support |
|---|---|
| Blazor WebAssembly | Everything |
| Blazor Web App, Interactive WebAssembly | Everything |
| Blazor Web App, Interactive Auto | Everything once interactive |
| Blazor Web App, Interactive Server | Everything; PNG, JPEG, BMP and GIF are coded on the server, WebP, AVIF and editor previews cross the circuit; see docs/browser-support.md |
| Prerendering | Managed codecs only, and capability detection reports Prerendering; call browser features from OnAfterRenderAsync |
| ASP.NET Core, console, worker | Headless API with the managed codecs, no browser involved |
MCP server (for AI agents)
The demo website hosts a Model Context Protocol server at
https://bmage.bitplatform.dev/mcp, and it is also served from the bit platform's combined endpoint at
https://bitplatform.dev/mcp. Point your coding agent at either to let it search the Bmage API, read worked examples
and setup guides, and review Bmage code. See the MCP server page of the demo website for the full tool list.
Tests
cd src/Utilities/Bmage/Tests/Bit.Bmage.Tests && dotnet test # engine tests, no browser needed
cd src/Utilities/Bmage/Tests/Bit.Bmage.Tests.E2E && dotnet test # drives a real browser against the demo website
cd src/Utilities/Bmage/Tests/Bit.Bmage.Tests.Mcp && dotnet test # the MCP server, hosted in-memory
dotnet run --project src/Utilities/Bmage/Tests/Bit.Bmage.Benchmarks -c Release -- --filter "*"
Documentation
- Getting started
- Architecture
- Pipelines
- The editor component
- Headless processing
- Formats and capabilities
- Metadata and privacy
- Performance
- Security
- Browser support
- Extending
- Troubleshooting
License
MIT. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- Microsoft.AspNetCore.Components.Web (>= 10.0.0 && < 11.0.0)
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.0 && < 9.0.0)
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.0 && < 10.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Bit.Bmage:
| Package | Downloads |
|---|---|
|
Bit.Bmage.Blazor
bit Bmage for Blazor: browser-side image processing on the user's device from strongly typed C#, on top of the Bit.Bmage engine. Browser-native WebP and AVIF codecs, capability detection, IBrowserFile/clipboard/camera input, loading and export and dependency injection wiring, with codec work in Web Workers. Works in WebAssembly, Server, Auto and Hybrid render modes. Includes BmageEditor, a themeable, accessible, touch-friendly image editor component: crop, rotate, adjust, filter, draw, annotate, redact, undo/redo and export. |
|
|
Bit.Bmage.Editor
A themeable, accessible, touch-friendly Blazor image editor component built on bit Bmage: crop, rotate, adjust, filter, draw, annotate, redact, undo/redo and export. |
|
|
Bit.Bmage.Bink
Connects Bit.Bmage images and Bit.Bink drawings: open a photo, screenshot or scan as the locked bottom layer of a Bink document to sign, mark up or annotate it, then render the drawing back into a Bmage image, flatten it onto the original, or keep it as a separate Bmage layer that stays editable. Everything runs in managed code, on the device or on a server. |
|
|
Bit.Bmage.BbScanner
Reads barcodes and QR codes from Bit.Bmage images with Bit.BbScanner's managed decoders, on the device or on a server, and when a photo will not read as it is, retries it through Bmage preprocessing: enlarged, sharpened, levelled or thresholded against its surroundings. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.0-pre-18 | 250 | 11/11/2026 |
| 11.0.0-pre-17 | 761 | 11/4/2026 |
| 11.0.0-pre-16 | 377 | 11/2/2026 |
| 11.0.0-pre-15 | 604 | 10/27/2026 |
| 11.0.0-pre-14 | 98 | 10/26/2026 |
| 11.0.0-pre-13 | 70 | 10/26/2026 |
| 11.0.0-pre-12 | 84 | 10/26/2026 |
| 11.0.0-pre-11 | 100 | 10/25/2026 |
| 11.0.0-pre-10 | 616 | 10/18/2026 |
| 10.7.0 | 393 | 10/25/2026 |
| 10.7.0-pre-04 | 182 | 10/25/2026 |
| 10.7.0-pre-03 | 451 | 10/22/2026 |
| 10.7.0-pre-02 | 110 | 10/22/2026 |