Reading a single image from a URL

The process of reading an image from a URL is first getting it downloaded to disk using the download function and then processing it, as in the preceding section:

image_url = "https://cdn.pixabay.com/photo/2018/01/04/18/58/cats-3061372_640.jpg?attachment"
downloaded_image_path = download(image_url)
downloaded_image = load(downloaded_image_path)

Depending on your project, it might make sense to download the file to a custom folder. You can define a download location by sending it as a second parameter to the download function:

image_url = "https://cdn.pixabay.com/photo/2018/01/04/18/58/cats-3061372_640.jpg?attachment"
downloaded_image_path = download(image_url, 'custom_image_name.jpg')
downloaded_image = load(downloaded_image_path)
Copyright notice: Pixabay provides images under CC0 Creative Commons. They are free for commercial use and no attributions are required.