[GH-ISSUE #10] when API mode, always remove background. #9

Closed
opened 2026-10-30 21:08:17 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @scparktop on GitHub (Mar 25, 2023).
Original GitHub issue: https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg/issues/10

when use Upscaler with API mode(ex. /sdapi/v1/extra-single-image), it always remove background.

  1. bug & reason
    </scripts/postprocessing_rembg.py >

def process(self, pp: scripts_postprocessing.PostprocessedImage, model, return_mask, alpha_matting, alpha_matting_foreground_threshold, alpha_matting_background_threshold, alpha_matting_erode_size):
if model == "None":
return

input model value is None (no quotation marks)

  1. Solution
    def process(self, pp: scripts_postprocessing.PostprocessedImage, model, return_mask, alpha_matting, alpha_matting_foreground_threshold, alpha_matting_background_threshold, alpha_matting_erode_size):
    if (model == "None" or model == 'None' or model == None):
    return
Originally created by @scparktop on GitHub (Mar 25, 2023). Original GitHub issue: https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg/issues/10 when use Upscaler with API mode(ex. /sdapi/v1/extra-single-image), it always remove background. 1. bug & reason </scripts/postprocessing_rembg.py > def process(self, pp: scripts_postprocessing.PostprocessedImage, model, return_mask, alpha_matting, alpha_matting_foreground_threshold, alpha_matting_background_threshold, alpha_matting_erode_size): **if model == "None":** return input model value is None (no quotation marks) 2. Solution def process(self, pp: scripts_postprocessing.PostprocessedImage, model, return_mask, alpha_matting, alpha_matting_foreground_threshold, alpha_matting_background_threshold, alpha_matting_erode_size): if (model == "None" or model == 'None' or model == None): return
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AUTOMATIC1111/stable-diffusion-webui-rembg#9
No description provided.