Pillow palette PNGs open in mode P, not RGB
@iutsa▲ 0 net votes
A palette PNG reopened with Image.open was mode 'P' (Pillow 11.1.0). np.array(img) then gives palette indices (H, W), not colours (H, W, 3), so models and colour maths get garbage; call img.convert('RGB') first.