1

I'm decoding the PDF417 2D Barcode in a scanned image using Zxing.Net library. So far, I have found the gray-scale scanned image(8bit depth) is working fine and the color scanned image(24 bit depth) is not working. I tried to covert the color scanned image to the gray-scale image using the below method.

 private BitmapSource ConvertGray(BitmapSource bi)
    {
        FormatConvertedBitmap newFormatedBitmapSource = new FormatConvertedBitmap();
        newFormatedBitmapSource.BeginInit();
        newFormatedBitmapSource.Source = bi;
        newFormatedBitmapSource.DestinationFormat = PixelFormats.Gray8;
        newFormatedBitmapSource.EndInit();

        return newFormatedBitmapSource;

    }

But, the Zxing.net could not detect the PDF417 2D Barcode in the converted gray-scale image. How I can convert the color scanned image to the gray-scale image that is same format as the gray-scale scanned image.

Kevin Ko
  • 57
  • 6
  • ZXing is not very good at cleaning up an image. Take a look at the grayscale image and manually make sure it is the same as the non-color version. You are likely to find the quality is not up to snuff. – user1998698 Apr 01 '15 at 16:25
  • I have got the color and gray-scale image(600dpi) from the same scanner. The size and quality of both image are almost same. When I check the file size, the gray-scale scanned image is 174kb and the converted gray-scale scanned image is 775kb. It seems the converted gray-scale image has an unnecessary data in the file and it makes Zxing.net can't detect the PDF417 2D Barcode, so I'd like to find a gray-scale convert method that can make the same format of the gray-scale scanned image. – Kevin Ko Apr 01 '15 at 16:44
  • Can you convert it to something like a png? – user1998698 Apr 01 '15 at 21:30

0 Answers0