Skip to content

Instantly share code, notes, and snippets.

@ting11222001
Created June 26, 2020 05:14
Show Gist options
  • Save ting11222001/122a9885b1344af82921237e2044f18a to your computer and use it in GitHub Desktop.
Save ting11222001/122a9885b1344af82921237e2044f18a to your computer and use it in GitHub Desktop.
# convert image into an array and ndim: 3
ImagenTotal = np.asarray(Image.open('./redmangos.jpg'))
# print(ImagenTotal.ndim)
#output: 3
# print(ImagenTotal.shape)
#output: (480, 640, 3)
# print(len(ImagenTotal))
#output: 480
# print(ImagenTotal)
#output: entire array
# print(ImagenTotal[0])
#output: the first [[255 255 255]…[38 51 41]]
# print(len(ImagenTotal[0]))
#output: the first [[255 255 255]…[38 51 41]]'s length, 640
# print(ImagenTotal[0][0])
#output: [255 255 255]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment