ZXing.Net icon indicating copy to clipboard operation
ZXing.Net copied to clipboard

ITF barcode is not decoded in tiff image, but decoded in JPG image

Open SanKumSan opened this issue 1 year ago • 7 comments

I have an ITF barcode with 10 digits value.

When an scanned tiff image with ITF barcode, tried to decode this barcode, NO value is decoded. But the same image, when scanned as JPG, and tried to decode, it is decoded successfully.

I am wondering why the image format, tiff or jpeg, effects the decoding of this ITF value. Any inputs are appreciated.

SanKumSan avatar Jul 18 '23 17:07 SanKumSan

Can you provide the JPG and TIFF files?

micjahn avatar Jul 18 '23 18:07 micjahn

sample_Jpeg Here is a jpeg sample image with ITF barcode and it is decoded.

SanKumSan avatar Jul 19 '23 08:07 SanKumSan

https://github.com/SanKumSan/testercr7/blob/main/sample_tiff.tif

Here is the tiff file with the same ITF barcode and it is not decoded by ZXing.

Note : Tiff has LZW compression.

Does the compression of the tiff effects the decoding behaviour ?

Does the image formats (tiff, jpeg, png and others) effects the decoding behaviour ?

SanKumSan avatar Jul 19 '23 08:07 SanKumSan

Hello @micjahn ,

Are you able decode the sample tiff file for ITF barcode ? Thanks

SanKumSan avatar Jul 25 '23 08:07 SanKumSan

Sorry, I can't check it for the next three weeks. Anyway, the file format doesn't affect the decoding success. Internally every image format is converted to Bitmap before decoding. Only the compression algorithm of the format can in some cases affect the bitmap quality (difference between lossless and not lossless compression).

micjahn avatar Jul 26 '23 15:07 micjahn

Thanks @micjahn . Thanks for the answers.

SanKumSan avatar Jul 28 '23 17:07 SanKumSan

I couldn't decode both of them if I used the original image size. If I reduce the size to 75% both versions are successfully decoded. I think the main problem is more or less the black-and-white ratio of the image and the pixel artifacts in the black areas. Perhaps a real-world image with more content would give better results. Or you generally shrink the scanned image by 25% before decoding which reduces artifacts in the black areas.

micjahn avatar Aug 22 '23 19:08 micjahn