tori29umai commited on
Commit
7775d86
1 Parent(s): 4d0b176
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -167,11 +167,15 @@ class webui:
167
  lineart = process_XDoG(image_path).convert('L')
168
  replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
169
  if alpha:
170
- replace_color_image.putalpha(alpha)
 
 
 
171
  replace_color_image_path = f"{image_name}_noline.png"
172
  replace_color_image.save(replace_color_image_path)
173
  lineart_image = lineart.convert('RGBA')
174
- lineart_image.putalpha(255 - lineart_image.getchannel('A'))
 
175
  lineart_image_path = f"{image_name}_lineart.png"
176
  lineart_image.save(lineart_image_path)
177
 
 
167
  lineart = process_XDoG(image_path).convert('L')
168
  replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
169
  if alpha:
170
+ alpha_channel = np.array(alpha)
171
+ inverted_alpha = 255 - alpha_channel
172
+ inverted_alpha_image = Image.fromarray(inverted_alpha)
173
+ replace_color_image.putalpha(inverted_alpha_image)
174
  replace_color_image_path = f"{image_name}_noline.png"
175
  replace_color_image.save(replace_color_image_path)
176
  lineart_image = lineart.convert('RGBA')
177
+ lineart_alpha = 255 - np.array(lineart)
178
+ lineart_image.putalpha(Image.fromarray(lineart_alpha))
179
  lineart_image_path = f"{image_name}_lineart.png"
180
  lineart_image.save(lineart_image_path)
181