Test in production without watermarks.
Works wherever you need it to.
Get 30 days of fully functional product.
Have it up and running in minutes.
Full access to our support engineering team during your product trial
In this tutorial, we delve into reading barcodes from images using Iron Barcode in C#. After installing Iron Barcode via the NuGet package manager, we proceed to the program's CS file to explore the code. The process begins with declaring the Iron Barcode namespace, followed by utilizing the BarcodeReader.Read
method to input the image file path. A foreach
loop is implemented to iterate over detected barcodes, printing each barcode's value to the console. The demonstration involves a single barcode, but the code supports multiple barcodes. Upon running the program, the console displays the barcode's string representation, which may include numbers, letters, or a combination of both. This confirms the successful reading of the barcode. We encourage viewers to subscribe for more tutorials from Iron Software. Additionally, a trial subscription is available for those interested in exploring the software further, accessible via the link in the video description.
// Make sure you've installed IronBarcode via NuGet
using IronBarCode;
namespace BarcodeReadingTutorial
{
class Program
{
static void Main(string[] args)
{
// Define the path to the image file containing the barcode
string imagePath = "path/to/your/barcode/image.jpg";
// Read barcodes from the image file
var barcodes = BarcodeReader.Read(imagePath);
// Iterate over each detected barcode
foreach (var barcode in barcodes)
{
// Print the barcode's value to the console
Console.WriteLine($"Barcode Value: {barcode.Value}");
}
}
}
}
// Make sure you've installed IronBarcode via NuGet
using IronBarCode;
namespace BarcodeReadingTutorial
{
class Program
{
static void Main(string[] args)
{
// Define the path to the image file containing the barcode
string imagePath = "path/to/your/barcode/image.jpg";
// Read barcodes from the image file
var barcodes = BarcodeReader.Read(imagePath);
// Iterate over each detected barcode
foreach (var barcode in barcodes)
{
// Print the barcode's value to the console
Console.WriteLine($"Barcode Value: {barcode.Value}");
}
}
}
}
' Make sure you've installed IronBarcode via NuGet
Imports IronBarCode
Namespace BarcodeReadingTutorial
Friend Class Program
Shared Sub Main(ByVal args() As String)
' Define the path to the image file containing the barcode
Dim imagePath As String = "path/to/your/barcode/image.jpg"
' Read barcodes from the image file
Dim barcodes = BarcodeReader.Read(imagePath)
' Iterate over each detected barcode
For Each barcode In barcodes
' Print the barcode's value to the console
Console.WriteLine($"Barcode Value: {barcode.Value}")
Next barcode
End Sub
End Class
End Namespace
Further Reading: How to Read Barcodes From Image Files (JPEG, PNG, GIF, TIFF, SVG, BMP)