Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -88,7 +88,6 @@ def visualize_mask(image, mask):
|
|
88 |
blended.save("debug_visualization.png") # Save debug image
|
89 |
return blended
|
90 |
|
91 |
-
# Overlay design on the T-shirt
|
92 |
def overlay_design(cloth_image, design_image):
|
93 |
# Ensure images are in RGBA mode
|
94 |
cloth_image = cloth_image.convert("RGBA")
|
@@ -104,13 +103,13 @@ def overlay_design(cloth_image, design_image):
|
|
104 |
|
105 |
# Resize the design to fit the T-shirt
|
106 |
design_width = int(tshirt_width * 0.6)
|
107 |
-
design_height = int(tshirt_height * 0.
|
108 |
resized_design = design_image.resize((design_width, design_height))
|
109 |
|
110 |
-
#
|
111 |
design_position = (
|
112 |
bbox[0] + (tshirt_width - design_width) // 2,
|
113 |
-
bbox[1] + (tshirt_height
|
114 |
)
|
115 |
|
116 |
# Create a transparent layer for the design
|
|
|
88 |
blended.save("debug_visualization.png") # Save debug image
|
89 |
return blended
|
90 |
|
|
|
91 |
def overlay_design(cloth_image, design_image):
|
92 |
# Ensure images are in RGBA mode
|
93 |
cloth_image = cloth_image.convert("RGBA")
|
|
|
103 |
|
104 |
# Resize the design to fit the T-shirt
|
105 |
design_width = int(tshirt_width * 0.6)
|
106 |
+
design_height = int(tshirt_height * 0.4) # Make the design height smaller for a better fit
|
107 |
resized_design = design_image.resize((design_width, design_height))
|
108 |
|
109 |
+
# Adjust position to move the design closer to the chest area
|
110 |
design_position = (
|
111 |
bbox[0] + (tshirt_width - design_width) // 2,
|
112 |
+
bbox[1] + int(tshirt_height * 0.25) # Slightly lower the design
|
113 |
)
|
114 |
|
115 |
# Create a transparent layer for the design
|