get image python code example
Example 1: open image from link python
from PIL import Image
import requests
from io import BytesIO
response = requests.get(url)
img = Image.open(BytesIO(response.content))
Example 2: read image in python
import numpy as np
import cv2
# Load an color image in grayscale
img = cv2.imread('Top-bike-wallpaper.jpg',0)
Example 3: how to write a script to display an image in python
>>> from PIL import Image
>>> img = Image.open('test.png')
>>> img.show()