We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d081e05 commit d33a400Copy full SHA for d33a400
image_downloader/main.py
@@ -0,0 +1,21 @@
1
+import requests
2
+from PIL import Image
3
+from io import BytesIO
4
+import os
5
+
6
+download_path = os.path.dirname(os.path.abspath(__file__))
7
+count = 1
8
+while True:
9
+ url = input("Enter Image URL: ")
10
+ try:
11
+ res = requests.get(url)
12
+ except Exception:
13
+ print("Invalid URL / Can't Access The URL")
14
+ continue
15
16
+ img = Image.open(BytesIO(res.content))
17
+ format = img.format
18
+ imgLoc = os.path.join(download_path, f"{count}.{format.lower()}")
19
+ img = img.save(imgLoc, format=format.upper())
20
+ print(f"Image Downloaded: {imgLoc}")
21
+ count += 1
0 commit comments