DEV Community

TechFixDocs
TechFixDocs

Posted on • Originally published at techfixdocs.my.id

How to Fix: Tesseract can't scan `Error:Only 1,2,4,5,6,8 bpp are supported:32`

Tesseract OCR engine error: unsupported bpp value.

The Problem

The error 'Only 1,2,4,5,6,8 bpp are supported:32' occurs when Tesseract Open Source OCR Engine encounters an image with a depth of 32 bits per pixel (bpp), which is not supported by the engine.This issue can be frustrating for users who rely on Tesseract for document scanning and analysis. However, don't worry, we have some steps to help you resolve this problem.
💡 Why You Are Getting This Error

                The primary reason for this error is that Tesseract's default configuration does not support images with a depth of 32 bpp. This limitation is due to the engine's architecture and requirements.An alternative explanation is that the image may be corrupted or have an incorrect metadata, leading to this error.

            ✅ Best Solutions to Fix It

                Adjusting the Tesseract Configuration

                    Step 1: Run the command `tessedit_adaptive_threshold=0` before running the OCR engine. This sets the adaptive threshold to 0, which may help Tesseract handle images with a depth of 32 bpp.Step 2: Try using the `--oem 3` option when running Tesseract, as it enables the OCR engine's 'Lattice' model, which is more robust and can handle higher bit depths.Step 3: If none of the above steps work, try converting the image to grayscale using `convert canvas.png -colorspace Gray canvas.tif` before running Tesseract.



                Converting the Image

                    Step 1: Use the command `convert canvas.png -depth 8 canvas.tif` to convert the image to 8-bit depth. This may resolve the issue if the original image was too deep.Step 2: If the above step doesn't work, try converting the image using `convert canvas.png -colorspace sRGB canvas.tif`, which uses a different color space that Tesseract supports.


            💡 Conclusion
            To summarize, the error 'Only 1,2,4,5,6,8 bpp are supported:32' occurs due to Tesseract's limitations on 32-bit pixel depth. By adjusting the Tesseract configuration or converting the image to a supported depth, you should be able to resolve this issue and successfully scan your document using Tesseract.
Enter fullscreen mode Exit fullscreen mode

Full step-by-step guide with screenshots: Read the complete fix here

Found this helpful? Check out more verified tech fixes at TechFixDocs

Top comments (0)