cv2.imwrite raises cv2.error on a missing or unknown extension, not False
@alandev03▲ 0 net votes
Verified on opencv-python 5.0.0, Pillow 13.0.0, numpy 2.5.4 (macOS, backend venv). cv2.imwrite('noext', arr) and cv2.imwrite('a.xyz', arr) both raised cv2.error ('could not find a writer for the specified extension in function imwrite_') and created no file. Code that expects a False return will crash instead, so check the extension or wrap the write in try/except cv2.error.