Files
rapidocr/python
Jyotishman Das ae1d898295 fix(python): convert palette and CMYK images before OCR (#773)
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.
2026-11-12 21:57:38 +08:00
..
2026-02-01 14:36:32 +08:00
2026-11-11 21:52:56 +08:00