zxing-wasm
    Preparing search index...

    Interface ReaderOptions

    Reader options for reading barcodes.

    interface ReaderOptions {
        binarizer?:
            | "LocalAverage"
            | "GlobalHistogram"
            | "FixedThreshold"
            | "BoolCast";
        characterSet?: | "Unknown"
        | "ASCII"
        | "ISO8859_1"
        | "ISO8859_2"
        | "ISO8859_3"
        | "ISO8859_4"
        | "ISO8859_5"
        | "ISO8859_6"
        | "ISO8859_7"
        | "ISO8859_8"
        | "ISO8859_9"
        | "ISO8859_10"
        | "ISO8859_11"
        | "ISO8859_13"
        | "ISO8859_14"
        | "ISO8859_15"
        | "ISO8859_16"
        | "Cp437"
        | "Cp1250"
        | "Cp1251"
        | "Cp1252"
        | "Cp1256"
        | "Shift_JIS"
        | "Big5"
        | "GB2312"
        | "GB18030"
        | "EUC_JP"
        | "EUC_KR"
        | "UTF16BE"
        | "UTF8"
        | "UTF16LE"
        | "UTF32BE"
        | "UTF32LE"
        | "BINARY";
        downscaleFactor?: number;
        downscaleThreshold?: number;
        eanAddOnSymbol?: "Ignore"
        | "Read"
        | "Require";
        formats?: ReadInputBarcodeFormat[];
        isPure?: boolean;
        maxNumberOfSymbols?: number;
        minLineCount?: number;
        returnErrors?: boolean;
        textMode?: "Plain" | "ECI" | "HRI" | "Escaped" | "Hex" | "HexECI";
        tryCode39ExtendedMode?: boolean;
        tryDenoise?: boolean;
        tryDownscale?: boolean;
        tryHarder?: boolean;
        tryInvert?: boolean;
        tryRotate?: boolean;
        validateOptionalChecksum?: boolean;
    }

    Hierarchy

    • Partial<
          Omit<
              ZXingReaderOptions,
              "formats"
              | "binarizer"
              | "eanAddOnSymbol"
              | "textMode"
              | "characterSet",
          >,
      >
      • ReaderOptions
    Index

    Properties

    binarizer?: "LocalAverage" | "GlobalHistogram" | "FixedThreshold" | "BoolCast"

    Algorithm to use for the grayscale to binary transformation. The difference is how to get to a threshold value T which results in a bit value R = L <= T.

    • "LocalAverage"

      T = average of neighboring pixels for matrix and GlobalHistogram for linear (HybridBinarizer)

    • "GlobalHistogram"

      T = valley between the 2 largest peaks in the histogram (per line in linear case)

    • "FixedThreshold"

      T = 127

    • "BoolCast"

      T = 0, fastest possible

    "LocalAverage"

    characterSet?:
        | "Unknown"
        | "ASCII"
        | "ISO8859_1"
        | "ISO8859_2"
        | "ISO8859_3"
        | "ISO8859_4"
        | "ISO8859_5"
        | "ISO8859_6"
        | "ISO8859_7"
        | "ISO8859_8"
        | "ISO8859_9"
        | "ISO8859_10"
        | "ISO8859_11"
        | "ISO8859_13"
        | "ISO8859_14"
        | "ISO8859_15"
        | "ISO8859_16"
        | "Cp437"
        | "Cp1250"
        | "Cp1251"
        | "Cp1252"
        | "Cp1256"
        | "Shift_JIS"
        | "Big5"
        | "GB2312"
        | "GB18030"
        | "EUC_JP"
        | "EUC_KR"
        | "UTF16BE"
        | "UTF8"
        | "UTF16LE"
        | "UTF32BE"
        | "UTF32LE"
        | "BINARY"

    Character set to use (when applicable). If this is set to "Unknown", auto-detecting will be used.

    "Unknown"

    downscaleFactor?: number

    Scale factor to use during downscaling, meaningful values are 2, 3 and 4.

    3

    Internally represented as an unsigned 8-bit integer (0..255).

    downscaleThreshold?: number

    Image size min(width, height) threshold at which to start downscaled scanning.

    500

    Internally represented as an unsigned 16-bit integer (0..65535).

    eanAddOnSymbol?: "Ignore" | "Read" | "Require"

    Specify whether to ignore, read or require EAN-2 / 5 add-on symbols while scanning EAN / UPC codes.

    • "Ignore"

      Ignore any Add-On symbol during read / scan

    • "Read"

      Read EAN-2 / EAN-5 Add-On symbol if found

    • "Require"

      Require EAN-2 / EAN-5 Add-On symbol to be present

    "Ignore"

    A set of ReadInputBarcodeFormats that should be searched for. An empty list [] indicates all supported formats.

    Accepted values are derived from barcodeFormat.ts (BCF) and include:

    • canonical format names (e.g. "QRCode", "Code128"),
    • meta format names (e.g. "All", "AllLinear"),
    • human-readable labels from the table (e.g. "QR Code", "Code 128"),
    • backward-compatible aliases (e.g. "Linear-Codes", "Matrix-Codes", "Any", "DataBarExpanded", "DataBarLimited", "rMQRCode").

    Values are normalized by encodeFormats before being sent to C++.

    []

    isPure?: boolean

    Set to true if the input contains nothing but a single perfectly aligned barcode (usually generated images).

    false

    maxNumberOfSymbols?: number

    The maximum number of symbols / barcodes to detect / look for in the image.

    Use 0 to remove the limit. Otherwise the effective range is 1..255.

    255

    Internally represented as an unsigned 8-bit integer (0..255).

    minLineCount?: number

    The number of scan lines in a linear barcode that have to be equal to accept the result.

    2

    Internally represented as an unsigned 8-bit integer (0..255).

    returnErrors?: boolean

    If true, return the barcodes with errors as well (e.g. checksum errors).

    false

    textMode?: "Plain" | "ECI" | "HRI" | "Escaped" | "Hex" | "HexECI"

    Specifies the TextMode that controls the result of ReadResult.text.

    • "Plain"

      ReadResult.bytes transcoded to unicode based on ECI info or guessed character set

    • "ECI"

      Standard content following the ECI protocol with every character set ECI segment transcoded to unicode

    • "HRI"

      Human Readable Interpretation (dependent on the ContentType)

    • "Hex"

      ReadResult.bytes transcoded to ASCII string of HEX values

    • "HexECI"

      ReadResult.bytesECI transcoded to ASCII string of HEX values

    • "Escaped"

      Escape non-graphical characters in angle brackets (e.g. ASCII 29 will be transcoded to "<GS>")

    "HRI"

    tryCode39ExtendedMode?: boolean

    Enable the heuristic to detect and decode "full ASCII" / extended Code39 symbols.

    true

    This option no longer has any effect and is kept only for backward compatibility. Use Code39Ext or Code39Std to select full ASCII or standard Code39 mode.

    tryDenoise?: boolean

    Try detecting code after denoising (currently morphological closing filter for 2D symbologies only).

    false

    tryDownscale?: boolean

    Try detecting code in downscaled images (depending on image size).

    true

    tryHarder?: boolean

    Spend more time to try to find a barcode. Optimize for accuracy, not speed.

    true

    tryInvert?: boolean

    Try detecting inverted (reversed reflectance) codes if the format allows for those.

    true

    tryRotate?: boolean

    Try detecting code in 90, 180 and 270 degree rotated images.

    true

    validateOptionalChecksum?: boolean

    Validate optional checksums where applicable (e.g. Code39, ITF).

    false