I am trying to save a bulk of image files after cropping them with cv2.IMWRITE_PNG_COMPRESSION, 9, but this is extremely slow. It takes about one hour for 5000 images.
cv2.imwrite(fn, img, [int(cv2.IMWRITE_PNG_COMPRESSION),9)
This is the command along with the path(fn), the image(img) and the compression mode, 9. If I use the default mode 3, that is by not giving the third argument the png's size gets doubled.
My qusetion is, Is there a way to optimize the process of compression, or any other library that can do this given that img has been opened using img = cv2.imread(src).