Class QrImageInput
Represents an image-based QR input implementing the IQrInput interface. Example:
var frame = new QrImageInput(new AnyBitmap("../assets/frame01.jpg"));
Inheritance
Namespace: IronQr
Assembly: IronQr.dll
Syntax
public class QrImageInput : Object, IQrInput
QrImageInput is the image wrapper handed to QrReader.Read. It adapts an image into the IQrInput contract the reader consumes, pairing the picture with the scan strategy used to detect codes in it.
Construct one from an AnyBitmap and a QrScanMode, where the bitmap can be loaded from a file, stream, or byte array, and the mode selects machine-learning or basic detection. The Image property exposes the wrapped bitmap and QrScanMode the chosen strategy. Because it holds an image and implements IDisposable, wrap it in a using statement so the bitmap is released after the read. The wrapped AnyBitmap is the bridge to the rest of the imaging stack, so a frame captured from a camera, a region cropped from a screenshot, or a page rendered from a PDF can all be read once they sit in a bitmap. The scan mode set here applies only to this input, so different inputs in the same run can use different strategies.
using var input = new QrImageInput(AnyBitmap.FromFile("qr.png"), QrScanMode.Auto);
IEnumerable<QrResult> results = reader.Read(input);The read QR code example wraps an image for reading, and the scan modes how-to selects the detection strategy.
Constructors
QrImageInput(AnyBitmap, QrScanMode)
Initializes a new instance of the QrImageInput class.
Declaration
public QrImageInput(AnyBitmap image, QrScanMode qrScanMode)
Parameters
| Type | Name | Description |
|---|---|---|
| IronSoftware.Drawing.AnyBitmap | image | The image to be used for QR code operations. |
| QrScanMode | qrScanMode | The QrScanMode to be used for QR code operations. Default is Auto. |
Properties
Image
Gets or sets the image to be used for QR code operations.
Declaration
public AnyBitmap Image { get; set; }
Property Value
| Type | Description |
|---|---|
| IronSoftware.Drawing.AnyBitmap |
QrScanMode
Define how IronQR scans and detects QR Codes in an image to read. By default, a ML model will scan the image, and a basic second scan will be run if the ML model finds none.
Declaration
public QrScanMode QrScanMode { get; set; }
Property Value
| Type | Description |
|---|---|
| QrScanMode |
Methods
Dispose()
Releases all resources used by the image.
Declaration
public void Dispose()