Preview:
import numpy as np
from PIL import Image

path = 'res/input.tga'
img = Image.open(path)

data = np.asarray(img.convert('L'))

# -- this will print the resolution of the image in pixels, as numpy converts our image to an
# -- array with dimensions equal to the number of pixels in width / height of the image.
print(data.shape)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter