'libpng error: Read Error' by using open cv imread

Jorre Goossens picture Jorre Goossens · Oct 11, 2017 · Viewed 9.6k times · Source

I am currently using Anaconda 4.3.27, Python 3.6.2 and OpenCV 3.3.0

When I try

img1 = cv2.imread('D:\Images\3D-Matplotlib.png')
img2 = cv2.imread('D:\Images\mainsvmimage.png')

I get libpng error: Read Errorand a pop-up shows up, indicating that Python stopped working. I already tried replacing the '\' by '\\' and '/', but also in those cases the same error shows up. When I try to read a jpg instead of a png, I do not get the error. Does anybody have an idea what might be the problem here?

Thanks in advance!

Edit:

Also cv2.imwrite gives an error:

libpng error: Write Error

Answer

Gregory Miller picture Gregory Miller · Apr 24, 2018

Had the same issue with Anaconda using Matplotlib with Latex. The solution was to update libpng. https://github.com/ContinuumIO/anaconda-issues/issues/6271