T.Masuda commited on
Commit
f39110f
·
1 Parent(s): 95201b7

update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -6,29 +6,22 @@ def process_image(foreImg, flip, backImg, left, top, width, height, isLoc):
6
  if foreImg is None:
7
  return None
8
 
 
 
 
 
 
 
9
  if isLoc:
10
  if backImg is None:
11
  return None
12
  rect = ImageDraw.Draw(backImg)
13
- imwidth = foreImg.width
14
- imheight = foreImg.height
15
- if width > 0:
16
- imwidth = width
17
- if height > 0:
18
- imheight = height
19
  rect.rectangle([(left, top), (imwidth + left, imheight + top)], outline=(255, 0, 0), width=4)
20
  return backImg
21
 
22
  image = remove(foreImg)
23
  if flip:
24
  image = ImageOps.mirror(image)
25
-
26
- imwidth = image.width
27
- imheight = image.height
28
- if width > 0:
29
- imwidth = width
30
- if height > 0:
31
- imheight = height
32
  image = image.resize((imwidth, imheight))
33
 
34
  if backImg is None:
 
6
  if foreImg is None:
7
  return None
8
 
9
+ imwidth, imheight = foreImg.size
10
+ if width > 0:
11
+ imwidth = width
12
+ if height > 0:
13
+ imheight = height
14
+
15
  if isLoc:
16
  if backImg is None:
17
  return None
18
  rect = ImageDraw.Draw(backImg)
 
 
 
 
 
 
19
  rect.rectangle([(left, top), (imwidth + left, imheight + top)], outline=(255, 0, 0), width=4)
20
  return backImg
21
 
22
  image = remove(foreImg)
23
  if flip:
24
  image = ImageOps.mirror(image)
 
 
 
 
 
 
 
25
  image = image.resize((imwidth, imheight))
26
 
27
  if backImg is None: