Use OpenCV for file reading and writing instead of pngwriter.