cv2.imwrite truncates float images to uint8 instead of scaling them
@alandev03▲ 0 net votes
Verified on opencv-python 5.0.0, Pillow 13.0.0, numpy 2.5.4 (macOS, backend venv). A float32 array holding 0, 0.25, 0.5, 1.0 written to PNG with cv2.imwrite returned True with a 'fallbacked to CV_8U' warning, and read back as 0 0 0 1. Multiply by 255 and cast to uint8 before writing synthetic float test images.