How to Read QR Code from Images

Reading a QR code refers to the process of scanning and decoding the information stored within a QR code. This is typically done using a camera or scanner paired with software that can interpret the QR code's data. The information in a QR code could be text, URLs, contact details, or other forms of data.

Read QR Codes from Images

One of IronQR's standout features is its built-in capability to read QR codes from various image formats seamlessly. This includes:

  • Joint Photographic Experts Group (JPEG)
  • Portable Network Graphics (PNG)
  • Graphics Interchange Format (GIF)
  • Tagged Image File Format (TIFF)
  • Bitmap Image File (BMP)
  • WBMP
  • WebP
  • Icon (ico)
  • WMF
  • RawFormat (raw)

This functionality is enabled by the open-source library, IronDrawing. Let's now explore how IronQR can be used to read QR codes from an image.

QR code
// Import necessary IronQR and IronDrawing namespaces
using IronSoftware.Drawing; 
using IronBarcode;

public class QRCodeReader
{
    public static void Main()
    {
        // Load an image from a file path
        using (var inputImage = Image.FromFile("path/to/your/image/file.webp"))
        {
            // Create a QrImageInput object from the image
            var qrImageInput = new QrImageInput(inputImage);

            // Decode the QR code from the image
            var result = BarcodeReader.Read(qrImageInput);

            // Iterate through each detected QR code and display its information
            foreach (var barcodeResult in result.Barcodes)
            {
                Console.WriteLine($"QR Code Data: {barcodeResult.Value}");
            }
        }
    }
}
// Import necessary IronQR and IronDrawing namespaces
using IronSoftware.Drawing; 
using IronBarcode;

public class QRCodeReader
{
    public static void Main()
    {
        // Load an image from a file path
        using (var inputImage = Image.FromFile("path/to/your/image/file.webp"))
        {
            // Create a QrImageInput object from the image
            var qrImageInput = new QrImageInput(inputImage);

            // Decode the QR code from the image
            var result = BarcodeReader.Read(qrImageInput);

            // Iterate through each detected QR code and display its information
            foreach (var barcodeResult in result.Barcodes)
            {
                Console.WriteLine($"QR Code Data: {barcodeResult.Value}");
            }
        }
    }
}
' Import necessary IronQR and IronDrawing namespaces
Imports IronSoftware.Drawing
Imports IronBarcode

Public Class QRCodeReader
	Public Shared Sub Main()
		' Load an image from a file path
		Using inputImage = Image.FromFile("path/to/your/image/file.webp")
			' Create a QrImageInput object from the image
			Dim qrImageInput As New QrImageInput(inputImage)

			' Decode the QR code from the image
			Dim result = BarcodeReader.Read(qrImageInput)

			' Iterate through each detected QR code and display its information
			For Each barcodeResult In result.Barcodes
				Console.WriteLine($"QR Code Data: {barcodeResult.Value}")
			Next barcodeResult
		End Using
	End Sub
End Class
$vbLabelText   $csharpLabel

Note: Replace "path/to/your/image/file.webp" with the actual path to your QR code image file.

Curious about the QR code value in the sample images? Give it a try using the code snippet!


Supported QR Code Types

Multiple types of QR codes are supported for both creation and reading. Below are the supported QR code types:

  • QRCode: This is the standard QR code most commonly used today. It can store a significant amount of data (up to 7,089 numeric characters or 4,296 alphanumeric characters), making it suitable for a wide range of applications, from website URLs to contact information.
QR code
  • MicroQRCode: The Micro QR Code is a smaller version of the standard QR code, designed for situations where space is limited. It can store less data than a standard QR code (up to 35 numeric characters or 21 alphanumeric characters), but its compact size makes it ideal for applications where a standard QR code would be too large, such as on small packaging or tiny printed labels.
Micro QR code
  • RMQRCode: RMQR Code (Rectangular Micro QR Code) is another compact version of the QR code but in a rectangular shape rather than a square. This version allows for flexibility in its aspect ratio, which can be useful for applications where a rectangular space is available. It can store data similar to the Micro QR Code but is designed for specific use cases where the available space is non-square.
Rectangular QR code

Frequently Asked Questions

What is required to read QR codes from images?

To read QR codes from images using IronQR, you need to download the IronQR library, import the image data using IronDrawing, create a QrImageInput object from the image data, and pass it to the Read method.

Which image formats are supported for reading QR codes?

IronQR supports various image formats, including JPEG, PNG, GIF, TIFF, BMP, WBMP, WebP, ico, WMF, and raw formats for reading QR codes.

What is the standard QR code and its capabilities?

The standard QR code can store a significant amount of data, up to 7,089 numeric characters or 4,296 alphanumeric characters, making it suitable for a range of applications from URLs to contact information.

How is a smaller QR code different from a standard QR code?

MicroQRCode is a smaller version of the standard QR code, designed for limited space situations. It can store up to 35 numeric characters or 21 alphanumeric characters, ideal for small packaging or tiny printed labels.

What is a compact rectangular QR code and when is it used?

RMQRCode, or Rectangular Micro QR Code, is a compact, rectangular version of the QR code. It offers flexibility in aspect ratio, useful for applications with non-square spaces.

How can I test the QR code reading functionality?

You can test the QR code reading functionality by using the provided code snippet. Replace 'path/to/your/image/file.webp' with the actual path to your QR code image file and run the code.

What software is used to interpret QR code data?

QR code data is interpreted using software that is paired with a camera or scanner. In this context, IronQR is the software used to read and interpret QR codes from images.

Chaknith Bin
Software Engineer
Chaknith works on IronXL and IronBarcode. He has deep expertise in C# and .NET, helping improve the software and support customers. His insights from user interactions contribute to better products, documentation, and overall experience.