M HYPE SPLASH
// updates

Software to automatically remove background from images?

By John Peck

Are there any Ubuntu alternatives to photoscissors, which makes it easy to remove the background of an image?

I'm currently using GIMP in different ways to do the same but for some images it takes a long time.

3 Answers

The imagemagick package includes a convert command.

Example commands:

convert image1.jpg -fuzz 20%% -transparent White image2.png
convert image1.png -threshold 10%% image2.png

Both are simple versions of removing a background and might make all other none-background white in the image transparent (the fuzzy/threshold options can adjust that).

But Imagemagick has examples on removing backgrounds using masks.

What works best depends on the original. JPG tend to be fuzzy (what looks like the same color often are slightly different colors) so they will have mixed results.

2
pip install --upgrade pip
pip install backgroundremover

Then simply

backgroundremover -i "/path/to/file.jpg" -o "out.png"

and if you want for video

backgroundremover -i "/path/to/video.mp4" -tg -o "output.gif"

source:

Example before and after:

Example photo

1

It depends on what part of the image you want to keep. It's tricky with photographs of landscape/objects etc. with many things in the background and is much easier with text.

Apart from what others have mentioned another method for simple removal of background is to import the image into Inkscape and use the trace bitmap map tool.

Fiddle around with the settings and so on and you should be able to get the part of the image you want without the background. In fact, you should check the remove background option

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy