I have an image file called "test.png"
I want to be able to read the image file as follows:
with open("test.png", "rb") as f:
input = f.read()
#Do some pre-processing on "input"
input_array = #some operation on the variable "input" to convert it to a numpy array
#processing "input_array"
output_dat = #some operation to convert input_array into the same format as variable "input"
Now, I want to be able to turn this input
data into a numpy array. How would I go about doing this, and vice-versa i.e., I also want to be able to convert it back to the format as input
is in.
- Convert
input
to a numpy array format - Convert numpy array back to the same format as
input