I am reading in images which I fetch from the internet and then immediately read into OpenCV in python as below:
# read in image as bytes from page
image = page.raw_stream.read()
frame = cv2.imdecode(np.asarray(bytearray(image)), 0)
and I am getting the libpng warning:
libpng warning: iCCP: known incorrect sRGB profile
How can I strip the sRGB profile before imread? People are suggesting to do it via imagemagick on the png files before reading them but this is not possible for me. Is there no way to do this in python directly?
EDIT:
I am unable to get the code in the answer below to fix my problem, if I run it with the file at https://uploadfiles.io/m1w2l and use the code:
import cv2
import numpy as np
with open('data/47.png', 'rb') as test:
image = np.asarray(bytearray(test.read()), dtype="uint8")
image = cv2.imdecode(image, cv2.IMREAD_COLOR)
I get the same warning