Image bytes to np array in Python

For reference:

# data - image bytes

im = Image.open(BytesIO(data))
I =  numpy.asarray(im)
print("I type:", type(I), "I shape:", I.shape)

>> I type: <class 'numpy.ndarray'> I shape: (512, 512, 3)

Comments

Popular posts from this blog

Java encoding : UTF-8, Big5, x-MS950-HKSCS