Questions tagged [rembg]

23 questions
3
votes
1 answer

rembg throws RuntimeError: LoadLibrary failed: onnxruntime_providers_tensorrt.dll

I am not able to generate the image whose background is removed from rembg import remove from PIL import Image input_path = "crop.jpeg" output_path = 'crop1.png' input = Image.open(input_path) output = remove(input) output.save(output_path) I…
2
votes
1 answer

Extract the background in an image and save

There are custom libraries in python that you can use to remove the background in images. An example is the rembg library used below: from rembg import remove from PIL import Image input_path = 'input.png' output_path = 'output.png' input =…
Mikee
  • 783
  • 1
  • 6
  • 18
1
vote
0 answers

Why code gives error even though llvmlite.dl is in specified directory

from PIL import Image from rembg import remove import glob import os input = Image.open(file) output = remove(input) output.save(f"{file}.png") Why code gives error even though llvmlite.dl is in specified directory "OSError: Could not…
Bru
  • 11
  • 1
1
vote
0 answers

Could not find a version that satisfies the requirement onnxruntime~=1.13.1 --> in chaqoupy android studio

I am trying to install rembg python library using chaquopy in android studio but the following error occurs: ERROR: Could not find a version that satisfies the requirement onnxruntime~=1.13.1 (from rembg) (from versions: none) ERROR: No matching…
1
vote
0 answers

How can I load a pre-trained onnx model in rembg Python script?

I try to load the pre-trained u2net_human_seg.onnx model in my python program to use it for better background removing. When I try it, I get an error: _pickle.UnpicklingError: invalid load key, '\x08'. My code: import rembg from PIL import…
1
vote
2 answers

How to specify the rembg model

I'm using rembg's model to extract images. It uses the default model. However, I want to use Python code to specify other rembg models to extract images Rembg prompts that rembg - m can be used, but I want to use python code
1
vote
1 answer

Can't write frame output with background removed to output video

I'm attempting to use opencv and rembg to write an output video that walks through each frame and once it reaches a specific point in the video (start_frame) it runs rembg (remove background) on every frame until it reaches end_frame. It writes the…
jport
  • 170
  • 12
0
votes
1 answer

Cropping image with "bad white" background while keeping a photographic scale

I have >1k photos with "bad white" background and a photographic scale. I need a proper white background to put them for publication. However, I would like to avoid to crop them all in Photoshop by hand. Issue = cropping the object as close as…
lekythos
  • 113
  • 1
  • 8
0
votes
0 answers

Error running Electron child_process.execFile with Python executable wrapped with PyInstaller and rembg library

I am encountering an issue when trying to run an Electron application that utilizes child_process.execFile to execute a Python script. The Python script is wrapped into an executable file using PyInstaller. Within the Python script, I have imported…
0
votes
0 answers

python rembg - change background color

I remove background but instead of having a transparent background I would like to have green for example but I don't understand how to do it. I want to change the background of my image for that I do: from rembg import remove import cv2 image =…
Eneska
  • 1
0
votes
1 answer

When launching a Python script using shell_exec, the script doesn't work

I have written a Python script that removes the background of an image using the rembg library and then composes the image using PIL. For this project, a virtualenv was created and rembg was installed there. All of this is on an Ubuntu 20.04…
0
votes
0 answers

How to get Rembg to keep shadows on objects

I'm trying to set up rembg to keep shadows on objects when the background is removed. Need this result: Code: from os import listdir, mkdir from os.path import isfile, join, getmtime from shutil import copy2 from datetime import datetime import…
dsm5e
  • 1
0
votes
0 answers

how to install rembg module with pip and pass llvmlite error

when i want to install rembg module in anaconda prompt with pip , i got an error about 'llvmlite' what should i do for solving this problem??? and I have this problem even to update the llvmlite module... (base) C:\Users\Admin>pip install…
shayan
  • 1
  • 1
0
votes
0 answers

Why does import rembg fail?

This is the first line of code in the module: from rembg import remove This is the error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) File…
nicomp
  • 4,344
  • 4
  • 27
  • 60
0
votes
0 answers

Errors in image background remover using Python with rembg and PIL - getting error in the modules I think?

So I'm making a super simple python program using rembg and PIL that I found on the internet. I'm getting an error that seems to be an issue with the module rembg or numpy, but I can't be sure. This is what the code looks like: from rembg import…
1
2