base64 문자열에서 데이터 URL 접두사를 제거하는 기능을 추가하였습니다. 이를 통해 이미지 디코딩 과정에서의 유연성을 향상시켰습니다.

This commit is contained in:
AGX 2025-08-29 22:54:36 +09:00
parent f2ff4697fa
commit b0ed5cbd7d
1 changed files with 4 additions and 0 deletions

View File

@ -45,6 +45,10 @@ def decode_base64_to_image(base64_string: str, gray: bool = False) -> Tuple[np.n
alpha_channel = None # 변수 초기화
try:
# 데이터 URL 형식인 경우, 접두사 제거 (e.g., "data:image/png;base64,")
if "," in base64_string:
base64_string = base64_string.split(',', 1)[1]
# base64 디코딩
image_data = base64.b64decode(base64_string)