unsupported format Old JPEG (in TIFF)
Posted: Fri Jan 27, 2012 12:51 pm
Here you can ask questions and get answers about VintaSoft products.
http://www.vintasoft.com/forums/
Code: Select all
' Important: You need Vintasoft.Barcode.dll,
' Vintasoft.Imaging.dll,
' to run this code.
Public Shared Sub ReadBarcodesUsingImaging(ByVal filename As String)
Dim images As New ImageCollection()
images.Add(filename)
' foreach images
For Each image As VintasoftImage In images
' get page Image
Dim pageImage As Image = image.GetAsBitmap()
' read barcodes
ReadBarcodesFromImage(pageImage)
' free resources
pageImage.Dispose()
Next
' free resources
images.ClearAndDisposeItems()
End Sub
Public Shared Sub ReadBarcodesFromImage(ByVal barcodeImage As Image)
' create barcode reader
Dim reader As New BarcodeReader()
' EAN13, Code 39, Code128 and DataMatrix barcodes are extracted
reader.Settings.ScanBarcodeTypes = BarcodeType.EAN13 Or BarcodeType.Code39 Or BarcodeType.Code128 Or BarcodeType.DataMatrix
' only horizontal barcodes are extracted
reader.Settings.ScanDirection = ScanDirection.Horizontal
' read barcodes from image
Dim infos As IBarcodeInfo() = reader.ReadBarcodes(barcodeImage)
If infos.Length = 0 Then
Console.WriteLine("No barcodes found.")
Else
Console.WriteLine(String.Format("{0} barcodes found:", infos.Length))
Console.WriteLine()
For i As Integer = 0 To infos.Length - 1
Dim info As IBarcodeInfo = infos(i)
Console.WriteLine(String.Format("[{0}:{1}]", i + 1, info.BarcodeType))
Console.WriteLine(String.Format("Value: {0}", info.Value))
Console.WriteLine(String.Format("Region: {0}", info.Region))
Console.WriteLine()
Next
End If
End Sub