Spaces:
Sleeping
Sleeping
Update text_integration.py
Browse files- text_integration.py +3 -2
text_integration.py
CHANGED
|
@@ -29,7 +29,7 @@ def add_text_to_image(image, text, text_x, text_y, font_size=36, font_color="#FF
|
|
| 29 |
return image
|
| 30 |
|
| 31 |
def create_text_preview(image, text, text_x, text_y, font_size=36, font_color="#FFFFFF"):
|
| 32 |
-
"""Erstellt eine Vorschau mit Text und rotem Marker"""
|
| 33 |
if image is None:
|
| 34 |
return image
|
| 35 |
|
|
@@ -38,11 +38,12 @@ def create_text_preview(image, text, text_x, text_y, font_size=36, font_color="#
|
|
| 38 |
if isinstance(image, np.ndarray):
|
| 39 |
image = Image.fromarray(image)
|
| 40 |
|
|
|
|
| 41 |
preview = image.copy()
|
| 42 |
draw = ImageDraw.Draw(preview)
|
| 43 |
|
| 44 |
# Nur roten Marker zeichnen wenn Text vorhanden UND Position nicht Standard (100,100)
|
| 45 |
-
if text and (text_x != 100 or text_y != 100):
|
| 46 |
# Rote Marker an Textposition
|
| 47 |
marker_radius = 8
|
| 48 |
marker_color = (255, 0, 0)
|
|
|
|
| 29 |
return image
|
| 30 |
|
| 31 |
def create_text_preview(image, text, text_x, text_y, font_size=36, font_color="#FFFFFF"):
|
| 32 |
+
"""Erstellt eine Vorschau mit Text und rotem Marker - nur EINEN Punkt"""
|
| 33 |
if image is None:
|
| 34 |
return image
|
| 35 |
|
|
|
|
| 38 |
if isinstance(image, np.ndarray):
|
| 39 |
image = Image.fromarray(image)
|
| 40 |
|
| 41 |
+
# Immer vom Originalbild starten, nicht von der vorherigen Vorschau
|
| 42 |
preview = image.copy()
|
| 43 |
draw = ImageDraw.Draw(preview)
|
| 44 |
|
| 45 |
# Nur roten Marker zeichnen wenn Text vorhanden UND Position nicht Standard (100,100)
|
| 46 |
+
if text and text_x is not None and text_y is not None and (text_x != 100 or text_y != 100):
|
| 47 |
# Rote Marker an Textposition
|
| 48 |
marker_radius = 8
|
| 49 |
marker_color = (255, 0, 0)
|