Search

Atalasoft Knowledge Base

FAQ: How Can I Recognize Barcodes on a Fax (Unequal X/Y Resolution) Image?

Administrator
DotImage

Typicaly, fax images have a complex resolution (dpi.X != dpi.Y), which will make barcodes on the image seem distorted. Our barcode reader requires that the image has dpi.X equal to dpi.Y. The solution to this is to simply resample the image using the ratio of the dpi as the multiplying factor. After the image is resampled, the Resolution property must be changd to match the new Dpi. For example,

[C#]

AtalaImage img = new AtalaImage(@"C:\FaxImage.TIF"); 
ImageCommand cmd = new ResampleCommand(new Size(img.Width, img.Height*(img.Resolution.X / img.Resolution.Y))); 
AtalaImage newImg = cmd.ApplyToImage(img); 
newImg.Resolution = new Dpi(img.Resolution.X,img.Resolution.X, img.Resolution.Units); 
TiffEncoder enc = new TiffEncoder(); 
newImg.Save(@"C:\DataMatrix.tif",enc, null);

[VB.NET]

Dim img As AtalaImage = New AtalaImage("C:\FaxImage.TIF") 
Dim cmd As ImageCommand = New ResampleCommand(New Size(img.Width, img.Height*(img.Resolution.X / img.Resolution.Y))) 
Dim newImg As AtalaImage = cmd.ApplyToImage(img) 
newImg.Resolution = New Dpi(img.Resolution.X,img.Resolution.X, img.Resolution.Units) 
Dim enc As TiffEncoder = New TiffEncoder() 
newImg.Save("C:\DataMatrix.tif",enc, Nothing)

Original Article:
Q10120 - FAQ: How can I recognize barcodes on a Fax image?

Details
Last Modified: 6 Years Ago
Last Modified By: Administrator
Type: FAQ
Article not rated yet.
Article has been viewed 787 times.
Options
Also In This Category