How to Read QR Code from Images

This article was translated from English: Does it need improvement?
Translated
View the article in English

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

Preguntas Frecuentes

¿Cómo puedo leer un código QR de una imagen en C#?

Para leer un código QR de una imagen en C#, descarga la biblioteca IronQR de NuGet, usa IronDrawing para importar los datos de la imagen, crea un objeto QrImageInput, y usa el método Read para decodificar el código QR.

¿Qué formatos de imagen son compatibles para leer códigos QR?

IronQR admite la lectura de códigos QR desde varios formatos de imagen, incluidos JPEG, PNG, GIF, TIFF, BMP, WBMP, WebP, ICO, WMF y formatos en bruto.

¿Qué tipos de códigos QR puede leer IronQR?

IronQR puede leer diferentes tipos de códigos QR, incluyendo el estándar QRCode, MicroQRCode y RMQRCode, cada uno diseñado para diferentes capacidades de datos y requisitos de espacio.

¿Cómo maneja IronQR los diferentes tamaños de códigos QR?

IronQR puede manejar códigos QR estándar, que almacenan grandes cantidades de datos, así como versiones más compactas como MicroQRCode y RMQRCode, que son adecuadas para espacios más pequeños o rectangulares.

¿Cómo puedo probar la funcionalidad de lectura de códigos QR en IronQR?

Para probar la funcionalidad de lectura de códigos QR en IronQR, utiliza el fragmento de código C# proporcionado, asegurándote de reemplazar 'path/to/your/image/file.webp' con la ruta real a tu archivo de imagen con el código QR.

¿Qué componentes de software son necesarios para interpretar los datos de códigos QR desde imágenes?

Para interpretar los datos de códigos QR desde imágenes, necesitas la biblioteca IronQR junto con IronDrawing para manejar los datos de imagen y decodificar los códigos QR.

¿Puede IronQR trabajar con códigos QR no cuadrados?

Sí, IronQR puede trabajar con códigos QR no cuadrados como RMQRCode, que es una versión rectangular adecuada para aplicaciones con espacios no cuadrados.

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más
¿Listo para empezar?
Nuget Descargas 47,669 | Versión: 2025.11 recién lanzado