I cannot change an image from web to an array.
Can anyone help?
Thank you very much.
from PIL import Image
from io import BytesIO
import requests
import numpy as np
url =r'https://drive.google.com/uc?id=1xrKyFZAIIR_XVhlhYGHlfLvIr5vQ5EnW'
img = Image.open(BytesIO(requests.get(url).content))
arr = np.array(img, dtype = np.uint8)
Traceback (most recent call last):
File "<pyshell#78>", line 1, in <module>
arr = np.array(img, dtype = np.uint8)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'JpegImageFile'