Gimp-Forum.net
Remove background - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Remove background (/Thread-Remove-background)

Pages: 1 2


Remove background - meetdilip - 03-05-2021

While I see many one-click remove background tools online, which works great too. I am a bit sceptic about my photos leaving my computer.

I always loved how GIMP helped do a lot of things and preserve our privacy at the same time. I wonder what are our options for background removal in GIMP 2.10.22. Is there any safe script or a reliable addon that we can use to make background removal easier ? Thanks.


RE: Remove background - rich2005 - 03-05-2021

You want to ensure that any trace of the original background is removed? What is the final exported image format that worries you ?

My tuppence worth Wink

For Jpegs there might be a residual thumbnail in the exif data that shows the original background. It will be small (my camera = 160x120 pix) but viewable.
You can extract the thumbnail with exiftool . Zero file size = no thumbnail.
Code:
exiftool -b -ThumbnailImage image.jpg > thumb.jpg
To get rid of all exif data get the little command line utility jpegoptim It is in the 'buntu repo. Of course you can just untick all the options in the Gimp export dialogues but thumbnails can carry over.

For png's with transparency there is the "saved colorpixels from transparent pixels" option. Turn that off when exporting your png. You can easily check. Open the png in Gimp, use the eraser tool with anti-erase (bottom of the tool options) checked. Does the erase uncover the transparency ? What is shown BG color or original ?

Tif's might be another format that can retain a thumbnail. Gif uses a colormap, not a problem.


RE: Remove background - meetdilip - 03-06-2021

Hi, perhaps I sounded a bit too much paranoid than I was. I won't be sharing the images outside my family. I would need some basic " take the person out " kind of background removal. Hopefully, a visually clear background will make me more than happy. I can draw a selection around the human aspects of the photo. But I wonder whether this is possible in a few clicks and random selection of foreground.

I somehow never got the knack of using the foreground selection tool. I simply wonder if those apps can remove backgrounds so easily, GIMP can do it too. Thanks.

PS : I normally use PNG for quality purpose.


RE: Remove background - eepjr24 - 03-06-2021

Davies Media offers a number of tutorials on just that type of thing. Step by step and pretty easy to follow, IMO.

https://daviesmediadesign.com/how-to-remove-anything-from-a-photo-in-gimp/


RE: Remove background - rich2005 - 03-06-2021

davies the dude - yeah right Wink

Try the gmic plugin Contours -> Extract Foreground (Interactive)
I had a photo example one time, but for Gimp 2.8 and anyway the gmic settings have changed a bit. I must have deleted it from yt.
This demo is a drawing but the principle is the same. https://youtu.be/Yu46Gs1NI34 about 4 minutes.

I often use this plugin as a starter and tidy up from there. No foolproof methods that I know for a complicated background.


RE: Remove background - meetdilip - 03-06-2021

I will check. Thanks Smile


RE: Remove background - nelo - 03-07-2021

Do you mean something like this here?
https://github.com/danielgatis/rembg


RE: Remove background - meetdilip - 03-07-2021

I saw it somewhere and someone said it would need a neural network installed on our PC. My machine is of moderate power. Do you think something that runs Blender, Inkscape and GIMP will be able to make this plugin work ? Thanks.


RE: Remove background - nelo - 03-07-2021

My machine is very old, relatively slow (compared to todays) has no SSD and such.
It works there.

The bottleneck is that I don't have an Nvidia driver installed so it has to use the CPU instead of GPU and takes about 2 or 3 minutes per photo. I saw a guy on youtube using it who has a nvidia driver and it was much quicker.
But hey ... I don't remove backgrounds by hand in that time ... so what.

Only thing needed is a python 3.8 ( and someone who's not afraid of commandline usage).
Installed via pip install rembg which does all that's necessary.
First run compiles some stuff, after that it's fine.


RE: Remove background - meetdilip - 03-07-2021

Thanks. How do I know which version of Python I have ? I use Ubuntu 20.04 and tried to learn Python, had Pychram installed a while ago. Now removed.

This machine has no graphics card, only onboard graphics from AMD.