Ask Your Question

Revision history [back]

Can't Decode Webp

I can open webp from file, but I can't get the following test code to decode the webp encoded format in memory on Python. I'd appreciate any pointer.

img = cv2.imread(file)

retval, buf = cv2.imencode(".webp", img, [cv2.IMWRITE_WEBP_QUALITY, 100])

img = cv2.imdecode(buf, 1)

imdecode_(''): can't read data: OpenCV(4.1.0) /io/opencv/modules/imgcodecs/src/grfmt_webp.cpp:164: error: (-215:Assertion failed) data.rows == 1 in function 'readData'