Skip to content

Jake-Derrick/MLKit.Maui.Barcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MLKit.Maui.Barcode

Provides easier access to Google ML Kits Barcode Scanning API for .NET MAUI.

BarcodeDetection

How to use it?

  1. Install the NuGet package
Install-Package MLKit.Maui.Barcode
  1. Initialize Barcode Service in MauiProgram.cs. See Supported formats
var builder = MauiApp.CreateBuilder()
    .UseMauiApp<App>()

builder.Services.AddBarcodeService(BarcodeFormat.Code_128, BarcodeFormat.QR, BarcodeFormat.PDF_417);
  1. Use service to get barcodes from a FileResult or an image byte[]
private readonly IBarcodeService _barcodeService;

public BarcodeExampleViewModel(IBarcodeService barcodeService)
{
    _barcodeService = barcodeService;
}

public async List<BarcodeResult> GetBarcodes(FileResult imageFile)
{
    List<BarcodeResult> barcodeResults = await _barcodeService.GetBarcodesFromImage(imageFile);
}

public async List<BarcodeResult> GetBarcodes(byte[] imageBytes)
{
    List<BarcodeResult> barcodeResults = await _barcodeService.GetBarcodesFromImage(imageBytes);
}

Supported Barcode Formats

  • Code_128
  • Code_39
  • Code_93
  • Codabar
  • EAN_13
  • EAN_8
  • ITF
  • UPC_A
  • UPC_E
  • QR
  • PDF_417
  • Aztec
  • DataMatrix

Detected Formats can be dynamically changed by using SetBarcodeFormats.

_barcodeService.SetBarcodeFormats(BarcodeFormat.All);

About

Provides easier access to Google ML Kits Barcode Scanning API for .NET MAUI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages