Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -139,7 +139,22 @@ def create_border_decoration(qr_image, decoration_style="Flowers"):
|
|
| 139 |
|
| 140 |
return decorated_image
|
| 141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
def create_qr(content, qr_type, fill_color, back_color, box_size, border_size, error_correction, border_decoration="No Decoration"):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
# QR 코드 데이터 포맷팅
|
| 144 |
formatted_data = format_data(content, qr_type)
|
| 145 |
|
|
|
|
| 139 |
|
| 140 |
return decorated_image
|
| 141 |
|
| 142 |
+
def rgba_to_rgb(rgba_color):
|
| 143 |
+
"""Convert RGBA color string to RGB hex color"""
|
| 144 |
+
if rgba_color.startswith('rgba'):
|
| 145 |
+
# Extract numbers from rgba string
|
| 146 |
+
values = rgba_color.strip('rgba()').split(',')
|
| 147 |
+
r = int(float(values[0]))
|
| 148 |
+
g = int(float(values[1]))
|
| 149 |
+
b = int(float(values[2]))
|
| 150 |
+
return f'#{r:02x}{g:02x}{b:02x}'
|
| 151 |
+
return rgba_color
|
| 152 |
+
|
| 153 |
def create_qr(content, qr_type, fill_color, back_color, box_size, border_size, error_correction, border_decoration="No Decoration"):
|
| 154 |
+
# Convert RGBA colors to RGB
|
| 155 |
+
fill_color = rgba_to_rgb(fill_color)
|
| 156 |
+
back_color = rgba_to_rgb(back_color)
|
| 157 |
+
|
| 158 |
# QR 코드 데이터 포맷팅
|
| 159 |
formatted_data = format_data(content, qr_type)
|
| 160 |
|