brilam/remove-bg

Collection of images

Closed this issue · 1 comments

What if i want to apply it on a all images in a folder?!

There is no function for a directory, however you can loop through all the images. It would look something like this:

from removebg import RemoveBg

rmbg = RemoveBg("YOUR-API-KEY", "error.log")
folder path = "some_dir"
for file in os.listdir(folder_path):
    file_name =  os.path.join(basepath, entry)
    if os.path.isfile(file_name):
        rmbg.remove_background_from_img_file("joker.jpg")