How-To: MICR line reading

Read MICR line and obtain fields

The following code demonstrates MICR line reading from an image file. After the value of the MICR line is obtained, the value of the MICR subfields can be obtain form CcMicrInfo.TextANSI property.

C#


VB


C++


PHP


Delphi


VBScript/ASP


Image resolution

It is recommended to scan checks with resolution of at least 100 dpi grayscale or 200 dpi bitonal.
The resolution reference value stored in the file should be the actual scanning resolution. . It is often the case that JPEG compressed check images carry an incorrect resolution tag. JPEG file resolution is frequently set to a default value of 72dpi or 96 dpi, when the actual scanning resolution might be 200 dpi. If the actual scanning resolution is known, but is incorrectly set in the file, then assign the correct resolution values to CcMicrReader.Image.HorztDpi and CcMicrReader.Image.VertDpi.

Camera images (including mobile phones) do not have a resolution property. To read MICR from such images, set the emrfExtendedMicrSearch flag in CcMicrReader.Flags

The scanning resolution resolution is available from Camcorder property. CcMicr.Dpi is a value approximated to one of several typical scanning resolutions.

MICR Line Location and orientation

CcMicrReader.FindMICR method expects the MICR line to be located at the bottom of the an image and fairly horizontal (with respect to the image edge)

If location and/or orientation of MICR line is arbitrary use CcMicrReader.ExtractCheck method to read MICR. This method also obtains check portion of an image in the correct orientation. The location of a check portion in the original document is available in CcMicr.Document properties: Top, Left, Right, Bottom

Multiple MICR lines

An Image may contain multiple MICR lines. e.g. IRD image, check image with coupon, or corrections strips, or multiple checks on one image.

CcMicrReader.FindMICR reads multiple lines ordered from bottom up. To read only the bottom MICR line set CcMicrReader.MaxMicrCount to 1

Since the check image portion of IRD (substitute check) may be scaled, its MICR resolution is not known. To read the check MICR from an IRD:

  • Scan at higher resolution e.g. 150 dpi grayscale 300 dpi bitonal to maintain quality of this MICR line
  • Set emrfExtendedMicrSearch flag in CcMicrReader.Flags. to compensate for unknown scale factor

ABA and Non-US checks

CcMicrReader reads E-13B MICR fonts as defined in X9.100-20. It does not read CMC-7 fonts.

To enforce compliance X9.100-160 (formerly X9.13) set chkEnforceAbaParsing flag in CcMicrReader.Flags. If flag is not set it is possible to read Non-US checks. Parsing of individual fields is performed so long as the format of the MICR line resembles the ABA format. However the application can always perform its own parsing if needed

Routing number

The routing number identifies the issuing bank. In US it is a 9 digit number consisting of 8 digit CcMicr.Routing and 1 digit CcMicr.RoutingChecksum. If the checksum is correct, then the confidence of the routing number is 100%

To obtain 9 digit routing concatenate CcMicr.Routing.TextANSI and CcMicr.RoutingChecksum.TextANSI

Text formats

Text value of MICR line and individual fields can be obtained is the following formats:

  • CcMicrInfo.TextANSI - Fields are formatted according X9.100-180 (formerly X9.37)
    Symbols: Routing: #, On-Us: / , Dash: -, Amount: $, Can’t Read: *
  • CcMicrInfo.TextRaw – All MICR characters are returned
    Symbols: Routing: T, On-Us: U , Dash: D, Amount: A, Can’t Read: ?, Space: _
  • CcMicrInfo.TextPacked – Same as TextRaw except "space" is removed

Poor quality image

If image is poor quality and MICR line is not read, try to set emrfExtendedMicrSearch flag in CcMicrReader.Flags. This activates a slower but more thorough MICR reading algorithm.

Individual characters of MICR line can be damaged (e.g. by handwriting) or by poor quality. Examples show how to obtain the value and confidence properties of the main (ECmFieldType.emftChr) and the alternative (ECmFieldType.emftChrAlt) character in every MICR line position. If confidence difference between main and alternative values is less than 15% it is possible that a substitution error has occurred.

Using ClearImage Repair and Tools before reading MICR

It might be required to pre-process image before reading MICR using CiRepair and CiTools class methods. In such cases use CcMicrReader.Ci object to create objects of these classes. For example:

CiRepair repair = reader.Ci.CreateRepair()