I have a lot of URLs of images stored on the web, example of a URL is as follows :
I want to load images from a similar URL as mentioned above and then do some operations on that image then return the resulting image.
So here's my code :
def get_image_from_url(url, path):
    try: 
        # downloading image from url
        img = requests.get(url)
        with open(path, 'wb') as f:
            f.write(img.content)
        # reading image, str(path) since path is object of Pathlib's path class
        img = cv2.imread(str(path), cv2.IMREAD_COLOR)
        # some operations 
        
        # deleting that downloaded image since it is of no use now   
        if os.path.exists(path):
            os.remove(path)
        return resulting_image
    except Exception as e:
        return np.zeros((224, 224, 3), np.uint8)
But this process is taking too much time so I thought instead of downloading and deleting the image I will directly load that image present on the URL into a variable.
Something like this :
def store_image_from_url(url):
    image = get_image_from_url(url) # without downloading it into my computer 
    # do some operations 
    return resulting_image
Is there any way to do the same?
Thank you