XbrzSharp 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package XbrzSharp --version 1.0.0
                    
NuGet\Install-Package XbrzSharp -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XbrzSharp" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XbrzSharp" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="XbrzSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XbrzSharp --version 1.0.0
                    
#r "nuget: XbrzSharp, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XbrzSharp@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XbrzSharp&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=XbrzSharp&version=1.0.0
                    
Install as a Cake Tool

XbrzSharp

.NET Build & Test NuGet License .NET

xBRZ: "Scale by rules" – high quality image upscaling filter by Zenju.

This is a .NET 8 port of xBRZ 1.8, based on the Java port by Stanio.

Important: This project is distinct from another .NET port xBRZ.NET (namespace xBRZNet).

Right ow it's a very straightforward port. Performance optimizations and more idiomatic .NET code may be added in the future.

Copyright (c) 2025 Ho Tzin Mein

Projects

  • XbrzSharp – Core xBRZ upscaling logic (library)
  • XbrzSharpTool – Command-line tool for batch image upscaling

Usage

Command-Line Tool

dotnet run --project XbrzSharpTool -- <source> [scaling_factor]
  • <source>: Path to the input image file or directory. If a directory is specified, all supported images in the directory will be upscaled.
  • [scaling_factor]: Optional integer (default: 2). Must be between 2 and 6.

The output will be saved as <source-image>@<factor>x.png in the same directory as the input file(s).

Library API Example

You can use the XbrzSharp library in your own .NET projects for programmatic upscaling:

using System.Drawing;
using System.Drawing.Imaging;
using Xbrz;

// Load your image as a Bitmap
using var bitmap = new Bitmap("input.png");

// Convert to ARGB int[] array
int width = bitmap.Width, height = bitmap.Height;
int[] srcPixels = new int[width * height];
var rect = new Rectangle(0, 0, width, height);
var data = bitmap.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
System.Runtime.InteropServices.Marshal.Copy(data.Scan0, srcPixels, 0, srcPixels.Length);
bitmap.UnlockBits(data);

// Perform scaling
int factor = 3;
var scaler = new XbrzScaler(factor, withAlpha: true);
int[] scaledPixels = scaler.ScaleImage(srcPixels, null, width, height);

// Convert back to Bitmap
int scaledWidth = width * factor, scaledHeight = height * factor;
var scaledBitmap = new Bitmap(scaledWidth, scaledHeight, PixelFormat.Format32bppArgb);
var scaledRect = new Rectangle(0, 0, scaledWidth, scaledHeight);
var scaledData = scaledBitmap.LockBits(scaledRect, ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
System.Runtime.InteropServices.Marshal.Copy(scaledPixels, 0, scaledData.Scan0, scaledPixels.Length);
scaledBitmap.UnlockBits(scaledData);

// Save the result
scaledBitmap.Save("output@3x.png");

Attribution for Test Assets

Test inputs and expected outputs are copied from the xBRZ Java port by Stanio:

Java port repository: https://github.com/stanio/xbzr-java

License

See LICENSE for full license texts.

Product 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 was computed.  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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 182 11/8/2025
1.1.0-beta.15 107 11/8/2025
1.1.0-beta.14 141 10/2/2025
1.0.2-beta.13 146 10/2/2025
1.0.2-beta.10 142 10/1/2025
1.0.2-beta.8 149 10/1/2025
1.0.1 207 10/1/2025
1.0.0 190 10/1/2025
1.0.0-beta.6 148 10/1/2025