edit : 이미지생성 api 생성갯수 삭제, 이미지생성 api 데이터를 return해주는 api 추가, 입력이미지 입력받아 검색하는 api 추가
This commit is contained in:
@@ -58,4 +58,15 @@ def image_to_base64_string(image_path: str) -> str:
|
||||
raise IOError(f"Error reading image file {image_path}: {e}")
|
||||
except Exception as e:
|
||||
# 그 외 예외 처리
|
||||
raise Exception(f"An unexpected error occurred: {e}")
|
||||
raise Exception(f"An unexpected error occurred: {e}")
|
||||
|
||||
|
||||
def save_base64_as_image_file(base64_data: str, output_path: str):
|
||||
"""
|
||||
Base64 문자열을 디코딩하여 이미지 파일로 저장합니다.
|
||||
"""
|
||||
# Base64 문자열을 디코딩하여 이진 데이터로 변환합니다.
|
||||
decoded_data = base64.b64decode(base64_data)
|
||||
with open(output_path, "wb") as image_file:
|
||||
image_file.write(decoded_data)
|
||||
|
||||
Reference in New Issue
Block a user