Files
ds_task_scan/backend/services/image_utils.py
T
Aherobo Ovie Victor 5e07248594 code reviewed
2025-07-22 09:46:32 +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)