Dev Center
Table of contents

Thanks for downloading Dynamsoft Barcode Reader Package!

Your download will start shortly. If your download does not begin, click here to retry.

How-to Guides - Read Barcodes with Different Colours

Common barcodes are black and white. However, some barcodes could be in different colors such as the below left barcode. Also, in some cases, a QR code may appear with an image or a logo inside as shown below right. Dynamsoft can decode such special barcodes as well.

Colour Barcode Colour Barcode

In some other cases, the barcodes can be white with a dark background color as shown on the right part of the image below:

Dark Background Barcode

To decode such kind of barcodes, the default runtime settings may fail. You can adjust the PublicRuntimeSettings like below:

char sError[512];
TextResultArray* paryResult = NULL;
PublicRuntimeSettings* runtimeSettings = new PublicRuntimeSettings();
CBarcodeReader* reader = new CBarcodeReader();
//Initialize license prior to any decoding
//Replace "<Put your license key here>" with your own license
reader->InitLicense("<Put your license key here>");
    
//Change the runtime settings to read both normal and inverted barcodes
reader->GetRuntimeSettings(runtimeSettings);
runtimeSettings->furtherModes.grayscaleTransformationModes[0] = GTM_ORIGINAL;
runtimeSettings->furtherModes.grayscaleTransformationModes[1] = GTM_INVERTED;
reader->UpdateRuntimeSettings(runtimeSettings, sError, 512);

//Replace "<Put your file path here>" with your own file path
reader->DecodeFile("<Put your file path here>", "");
// If succeeds
reader->GetAllTextResults(&paryResult);
CBarcodeReader::FreeTextResults(&paryResult);
delete runtimeSettings;
delete reader;

See Image Scale and Colour Conversion for more information about what you can do during image pre-processing.

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

latest version

    • Latest version
    • Version 10.x
      • Version 10.2.0
      • Version 10.0.21
      • Version 10.0.20
      • Version 10.0.10
      • Version 10.0.0
    • Version 9.x
      • Version 9.6.42
      • Version 9.6.40
      • Version 9.6.33
      • Version 9.6.32
      • Version 9.6.31
      • Version 9.6.30
      • Version 9.6.20
      • Version 9.6.10
      • Version 9.6.0
      • Version 9.4.0
      • Version 9.2.0
      • Version 9.0.0
    • Version 8.x
      • Version 8.8.0
      • Version 8.6.0
      • Version 8.4.0
      • Version 8.2.0
      • Version 8.1.2
      • Version 8.1.0
      • Version 8.0.0
    • Version 7.x
      • Version 7.6.0
      • Version 7.5.0
    Change +