Gopalag commited on
Commit
afdca6f
·
verified ·
1 Parent(s): 6072191

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -31,13 +31,13 @@ def create_tshirt_preview(design_image, tshirt_color="white"):
31
  design_image = Image.fromarray(design_image)
32
 
33
  # Resize design to fit nicely on shirt (40% of shirt width)
34
- design_width = int(tshirt_width * 0.4) # Adjust this percentage as needed
35
  design_height = int(design_width * design_image.size[1] / design_image.size[0])
36
  design_image = design_image.resize((design_width, design_height), Image.Resampling.LANCZOS)
37
 
38
  # Calculate position to center design on shirt
39
- x = (tshirt_width - design_width) // 2
40
- y = int(tshirt_height * 0.3) # Adjust this value based on your template
41
 
42
  # If design has transparency (RGBA), create mask
43
  if design_image.mode == 'RGBA':
 
31
  design_image = Image.fromarray(design_image)
32
 
33
  # Resize design to fit nicely on shirt (40% of shirt width)
34
+ design_width = int(tshirt_width * 0.35) # Adjust this percentage as needed
35
  design_height = int(design_width * design_image.size[1] / design_image.size[0])
36
  design_image = design_image.resize((design_width, design_height), Image.Resampling.LANCZOS)
37
 
38
  # Calculate position to center design on shirt
39
+ x = (tshirt_width - design_width) // 2.2
40
+ y = int(tshirt_height * 0.20) # Adjust this value based on your template
41
 
42
  # If design has transparency (RGBA), create mask
43
  if design_image.mode == 'RGBA':