tori29umai commited on
Commit
21e05f5
β€’
1 Parent(s): ebcb006
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -170,19 +170,25 @@ class webui:
170
  rgb_image = image.convert('RGB')
171
  lineart = process_XDoG(image_path).convert('L')
172
  replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
 
173
  if alpha:
174
- replace_color_image.putalpha(alpha)
 
 
175
  replace_color_image_path = f"{image_name}_noline.png"
176
  replace_color_image.save(replace_color_image_path)
 
177
  lineart_image = lineart.convert('RGBA')
178
  lineart_alpha = 255 - np.array(lineart)
179
- lineart_image.putalpha(Image.fromarray(lineart_alpha))
 
180
  lineart_image_path = f"{image_name}_lineart.png"
181
  lineart_image.save(lineart_image_path)
182
 
183
  zip_files_list = [replace_color_image_path, lineart_image_path]
184
  zip_path = f"{image_name}.zip"
185
  zip_files(zip_files_list, zip_path)
 
186
  outputs = [replace_color_image, lineart_image]
187
  return outputs, zip_path
188
 
 
170
  rgb_image = image.convert('RGB')
171
  lineart = process_XDoG(image_path).convert('L')
172
  replace_color_image = process_image(rgb_image, lineart).convert('RGBA')
173
+
174
  if alpha:
175
+ inverted_alpha = ImageOps.invert(alpha) # をルフゑチャンネルを反軒
176
+ replace_color_image.putalpha(inverted_alpha)
177
+
178
  replace_color_image_path = f"{image_name}_noline.png"
179
  replace_color_image.save(replace_color_image_path)
180
+
181
  lineart_image = lineart.convert('RGBA')
182
  lineart_alpha = 255 - np.array(lineart)
183
+ lineart_image.putalpha(Image.fromarray(lineart_alpha))
184
+
185
  lineart_image_path = f"{image_name}_lineart.png"
186
  lineart_image.save(lineart_image_path)
187
 
188
  zip_files_list = [replace_color_image_path, lineart_image_path]
189
  zip_path = f"{image_name}.zip"
190
  zip_files(zip_files_list, zip_path)
191
+
192
  outputs = [replace_color_image, lineart_image]
193
  return outputs, zip_path
194