Files
ds_task_scan/backend/image_utils.py
T
Aherobo Ovie Victor 49c82456c9 Initial commit
2025-07-19 11:55:09 +01:00

16 lines
481 B
Python

import requests
from PIL import Image
from io import BytesIO
def download_image(image_url: str, save_path: str) -> None:
"""
Download an image from a URL and save it to a local path.
Args:
image_url (str): The URL of the image to download.
save_path (str): The local file path to save the image.
"""
response = requests.get(image_url)
response.raise_for_status()
image = Image.open(BytesIO(response.content))
image.save(save_path)