IronBarcode 標誌

從圖片中讀取條碼 C#

  • 從圖片中提取條碼。
  • 支援多種條碼類型。
  • 高條碼讀取準確性。
  • 簡單整合至 C# 應用程式。
  • 從流中讀取條碼。
值得信賴的
由:
NASA標誌赫茲標誌3M 標誌特斯拉標誌

免費開始

No credit card or account creation required
Test Icon

在實際環境中測試

在生產環境中測試無浮水印。
在任何需要的地方都能運作。

Functional Icon

全功能產品

獲得30天完全功能的產品。
幾分鐘內即可啟動並運行。

Support Icon

24/5技術支援

試用產品期間完全訪問我們的支援工程團隊

Barcode 快速入門

using IronBarCode;
using System.Drawing;

// Creating a barcode is as simple as:
var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);

// And save our barcode as in image:
myBarcode.SaveAsImage("EAN8.jpeg");

Image myBarcodeImage = myBarcode.Image; // Can be used as Image
Bitmap myBarcodeBitmap = myBarcode.ToBitmap(); // Can be used as Bitmap

// Reading a barcode is easy with IronBarcode:
var resultFromFile = BarcodeReader.Read(@"file/barcode.png"); // From a file
var resultFromBitMap = BarcodeReader.Read(new Bitmap("barcode.bmp")); // From a bitmap
var resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")); // From an image
var resultFromPdf = BarcodeReader.ReadPdf(@"file/mydocument.pdf"); // From PDF use ReadPdf

// After creating a barcode, we may choose to resize and save which is easily done with:
var myNewBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
myNewBarcode.ResizeTo(400, 100);
myNewBarcode.SaveAsImage("myBarcodeResized.jpeg");

// To set more options and optimization with your Barcode Reading,
// Please utilize the BarcodeReaderOptions paramter of read:
var myOptionsExample = new BarcodeReaderOptions
{
    // Choose a speed from: Faster, Balanced, Detailed, ExtremeDetail
    // There is a tradeoff in performance as more Detail is set
    Speed = ReadingSpeed.Balanced,

    // Reader will stop scanning once a barcode is found, unless set to true
    ExpectMultipleBarcodes = true,

    // By default, all barcode formats are scanned for.
    // Specifying one or more, performance will increase.
    ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,

    // Utilizes multiple threads to reads barcodes from multiple images in parallel.
    Multithreaded = true,

    // Maximum threads for parallel. Default is 4
    MaxParallelThreads = 2,

    // The area of each image frame in which to scan for barcodes.
    // Will improve performance significantly and avoid unwanted results and avoid noisy parts of the image.
    CropArea = new Rectangle(),

    // Special Setting for Code39 Barcodes.
    // If a Code39 barcode is detected. Try to use extended mode for the full ASCII Character Set
    UseCode39ExtendedMode = true
};

// And, apply:
var results = BarcodeReader.Read("barcode.png", myOptionsExample);
Imports IronBarCode
Imports System.Drawing

' Creating a barcode is as simple as:
Private myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)

' And save our barcode as in image:
myBarcode.SaveAsImage("EAN8.jpeg")

Dim myBarcodeImage As Image = myBarcode.Image ' Can be used as Image
Dim myBarcodeBitmap As Bitmap = myBarcode.ToBitmap() ' Can be used as Bitmap

' Reading a barcode is easy with IronBarcode:
Dim resultFromFile = BarcodeReader.Read("file/barcode.png") ' From a file
Dim resultFromBitMap = BarcodeReader.Read(New Bitmap("barcode.bmp")) ' From a bitmap
Dim resultFromImage = BarcodeReader.Read(Image.FromFile("barcode.jpg")) ' From an image
Dim resultFromPdf = BarcodeReader.ReadPdf("file/mydocument.pdf") ' From PDF use ReadPdf

' After creating a barcode, we may choose to resize and save which is easily done with:
Dim myNewBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)
myNewBarcode.ResizeTo(400, 100)
myNewBarcode.SaveAsImage("myBarcodeResized.jpeg")

' To set more options and optimization with your Barcode Reading,
' Please utilize the BarcodeReaderOptions paramter of read:
Dim myOptionsExample = New BarcodeReaderOptions With {
	.Speed = ReadingSpeed.Balanced,
	.ExpectMultipleBarcodes = True,
	.ExpectBarcodeTypes = BarcodeEncoding.AllOneDimensional,
	.Multithreaded = True,
	.MaxParallelThreads = 2,
	.CropArea = New Rectangle(),
	.UseCode39ExtendedMode = True
}

' And, apply:
Dim results = BarcodeReader.Read("barcode.png", myOptionsExample)
Install-Package BarCode

探索程式碼並執行以查看範例。

世界級工程,
24小時支援