ECoding.InkAnchor 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ECoding.InkAnchor --version 1.0.0
                    
NuGet\Install-Package ECoding.InkAnchor -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="ECoding.InkAnchor" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ECoding.InkAnchor" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ECoding.InkAnchor" />
                    
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 ECoding.InkAnchor --version 1.0.0
                    
#r "nuget: ECoding.InkAnchor, 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 ECoding.InkAnchor@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=ECoding.InkAnchor&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ECoding.InkAnchor&version=1.0.0
                    
Install as a Cake Tool

ECoding.InkAnchor

ECoding.InkAnchor is a versatile .NET 9 library designed to easily generate and analyze customizable anchor boxes using ArUco markers. It enables structured image generation, automated extraction, and evaluation of image content.


Key Features

  • Anchor Box Generation: Create raster or SVG images containing labeled and customizable anchor boxes defined by ArUco markers.
  • Marker Detection and Extraction: Efficiently detect anchor boxes from scanned images and extract content between ArUco markers.
  • Content Evaluation: Measure the filled area percentage within extracted image sections, ideal for automated processing of handwritten or marked content.

Installation

Install the library easily via NuGet:

dotnet add package ECoding.InkAnchor

Usage

Generating Anchor Box Images

var options = new InkAnchorGeneratorOptions(boxId: 1, pixelWidth: 400, pixelHeight: 200)
{
    FillColor = Color.White,
    Border = new InkAnchorBorder(Color.Black, thickness: 2, borderStyle: InkAnchorBorder.BorderStyle.Dashed),
    BoxLabel = new InkAnchorLabel("Signature Box", BoxLabelPlacement.TopOutsideBox, fontSize: 14, color: Color.Black)
};

var image = await InkAnchorHandler.GenerateAnchorBoxImageAsync(options);
await image.SaveAsync("anchor_box.png");

Generating SVG Anchor Boxes

var svgContent = await InkAnchorHandler.GenerateAnchorBoxSvgAsync(options);
await File.WriteAllTextAsync("anchor_box.svg", svgContent);

Detecting and Extracting Boxes from Images

using var inputImage = Image.Load<Rgba32>("scanned_page.png");
var extractedBoxes = InkAnchorHandler.GetAnchorBoxesContentImage(inputImage);

foreach (var (boxId, croppedImage) in extractedBoxes)
{
    await croppedImage.SaveAsync($"extracted_box_{boxId}.png");
}

Evaluating Filled Area Percentage

using var croppedImage = Image.Load<Rgba32>("extracted_box.png");
double filledPercentage = InkAnchorHandler.GetFilledAreaPercentage(croppedImage, brightnessThreshold: 225);
Console.WriteLine($"Filled Area: {filledPercentage * 100:0.##}%");

Configuration Options

InkAnchorGeneratorOptions

  • BoxId (byte): Unique identifier for the anchor box.
  • PixelWidth/PixelHeight (int): Dimensions of the box, minimum 30 pixels.
  • MarkerPixelSize (int): Pixel size of ArUco markers, default is 60 px.
  • MarkerBorderBits (int): Border bits around markers, default 1.
  • MarkerPadding (int): Padding between marker and box border, default 1.
  • FillColor (Color?): Background color, default transparent.
  • Border (InkAnchorBorder?): Border styling and settings.
  • BoxLabel (InkAnchorLabel?): Label text, placement, and styling.

InkAnchorBorder

Customize borders using:

  • Color: Border color.
  • Thickness: 1-5 pixels.
  • Style: Solid, Dashed, Dotted.
  • Sides: Top, Right, Bottom, Left, All.

InkAnchorLabel

Configure labels with:

  • LabelText: Text for the label (max 100 characters).
  • Color: Text color.
  • FontSize: Between 5 and 25 pixels.
  • Font: Font family.
  • LabelPlacement: Top or Bottom outside the box.

Contributing

Contributions, feature requests, and bug reports are welcome! Please create an issue or submit a pull request on GitHub.


License

Licensed under the MIT License.


Dependencies


Acknowledgments

Thanks to the authors and maintainers of SixLabors.ImageSharp and OpenCvSharp for enabling powerful imaging and vision processing capabilities in .NET.

Product Compatible and additional computed target framework versions.
.NET 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 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.

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
2.1.0 230 9/19/2025
2.0.2 136 8/19/2025
2.0.1 139 8/18/2025
2.0.0 184 6/5/2025
1.2.1 190 5/22/2025
1.2.0 166 5/21/2025
1.0.1 252 5/13/2025
1.0.0 182 4/8/2025