If you have a web URL for an Image and you want to save it to a specific location using Python then you can make use of the requests module.
The first thing is you should make sure that you have installed the requests module using pip.
pip install requests
pip3 install requests
Example:
import requests
image_url = "https://code2care.org/c2c-img/icons/python.png"
image_content = requests.get(image_url).content
with open('python.png', 'wb') as handler:
handler.write(image_content)

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!