Update app.py
Browse files
app.py
CHANGED
@@ -23,8 +23,7 @@ def load_image_as_bytes(image_path):
|
|
23 |
"""Chuyển ảnh thành dữ liệu nhị phân với kiểm tra lỗi"""
|
24 |
try:
|
25 |
with Image.open(image_path) as img:
|
26 |
-
img = img.
|
27 |
-
convert("RGB") # Đảm bảo ảnh là RGB
|
28 |
img_bytes = BytesIO()
|
29 |
img.save(img_bytes, format="JPEG") # Lưu ảnh vào buffer
|
30 |
return img_bytes.getvalue() # Lấy dữ liệu nhị phân
|
|
|
23 |
"""Chuyển ảnh thành dữ liệu nhị phân với kiểm tra lỗi"""
|
24 |
try:
|
25 |
with Image.open(image_path) as img:
|
26 |
+
img = img.convert("RGB") # Đảm bảo ảnh là RGB
|
|
|
27 |
img_bytes = BytesIO()
|
28 |
img.save(img_bytes, format="JPEG") # Lưu ảnh vào buffer
|
29 |
return img_bytes.getvalue() # Lấy dữ liệu nhị phân
|