nadermx / backgroundremover

Background Remover lets you Remove Background from images and video using AI with a simple command line interface that is free and open source.
https://www.backgroundremoverai.com
MIT License
6.43k stars 534 forks source link

Cannot use background image with images? #113

Open kyeno opened 6 months ago

kyeno commented 6 months ago

Hey!

I tried quite a few variants of using plain-white-image as a background and the -bi option, but it doesn't seem to bother at all when working with images (JPEGs in my case).

kyeno commented 6 months ago

I "worked around" this with a simple bash script additionally invoking ImageMagick:

NOTE: This is made to batch-process entire directories.

#!/bin/sh
for a in *; do 
  backgroundremover -i "$a" -wn 32 -gb 10 -m "u2net_human_seg" -o "bgr_tmp_$a.png"
  convert -flatten "bgr_tmp_$a.png" "bgr_$a.png"
  rm -f "bgr_tmp_$a.png"
done
nadermx commented 6 months ago

I'll look into this

shiunyi71 commented 3 months ago

I have the same question, but I found another solution. I use the model to generate the mask video into a mp4 file. This file is much smaller than the mov file. I use FFmpeg to combine the input video with the mask video on a background image or video to generate the final video into a mp4 file. This way can avoid producing a huge mov file.