How will you locally save an image using its url address?



How will you locally save an image using its url address?..

Answer / Seema Rani

You can use libraries like `requests` to download an image, and `Pillow` (Python Image Library) to save it. Here's a simple example:

```python
import requests
from PIL import Image

response = requests.get('image_url')
img = Image.open(bytesio=BytesIO(response.content))
img.save('local_file_name.jpg', format='JPEG')
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Describe how to send email from a python script?

1 Answers  


Is python a scripting or programming?

1 Answers  


What is os module?

1 Answers  


How long do goats sleep?

1 Answers  


find max length of any given sublist?

1 Answers  


Short description of the scoping rules?

1 Answers  


What are python dictionaries?

1 Answers  


How do you break in python?

1 Answers  


What is a namespace in python?

1 Answers  


How to convert a number to a string?

1 Answers  


What is python main function and write one good example?

1 Answers  


What is the difference between methods & constructors?

1 Answers  


Categories