mirror of
https://github.com/RapidAI/RapidOCR.git
synced 2026-11-12 22:10:55 +08:00
img_to_ndarray passed the raw PIL array straight to convert_img. For palette (P) images that array holds palette indices, so a typical two-colour PNG reaches the detector as an almost black image and no text is found. CMYK images give four ink channels that were treated as RGBA, so a CMYK JPEG also returned no result. Convert P images to RGBA, which keeps any palette transparency for the existing alpha handling, and CMYK images to RGB. Path, bytes and PIL inputs all go through this function.