Gimp-Forum.net

Full Version: Make GIF background transparent
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I have a .gif file with 27 frames, all white background. Is it possible to clear the white background from all the layers without manually handling them one by one? Thanks.
All depends on the animation. You will have to convert the gif from Indexed to RGB for the attached script c2a-all-layers then re-export as a gif.
...but that can introduce semi-transparency in some remaining colours.

...or non-Gimp using ImageMagick  try (change -fuzz percentage as required, not even sure it is required for a gif Wink )

Code:
magick infile.gif -fuzz 10% -transparent white new.gif
Thanks, this is the base GIF

While most of it worked well, it also removed the white inside the character.
Yes, such is life. Only 27 layers, Do each individually. Too high a fuzz value removes part of the panda. A small value leaves a border.
No problem. Thanks Smile
(08-10-2022, 01:46 PM)meetdilip Wrote: [ -> ]No problem. Thanks Smile

You can also use ofn-layer-tiles to change you animation into a single image, remove the background on that, and then split it back to 27 layers (also with ofn-layer-tiles).
Did a try with the saulgoode overlay background http://chiselapp.com/user/saulgoode/repo...combine-bg
Created a WHITE layer at the bottom ➤ mode color erase then run the scm ➤ overlay background

on the gif it removes some white on the panda, but as a webp animation... not bad (a very slight transparency on the whites, though, but not bad)

GIF
[attachment=8478]

WEBP
[Image: kungfu-panda.webp]
Got this one

[attachment=8481]
Some time ago there was a similar question about batch removing backgrounds, I tried a little plugin isolate which worked fine on single images but not using BIMP.

So, an adaptation for an animation (version 2) It is very linear, just what you do by, manually fuzzy select BG / grow selection a pixel / cut the selection.

Since it fuzzy selects, the animation does need a plain color contiguous BG. The panda gif needs a bit of preparation. The original is optimized, so unoptimise. Increase the canvas size to make the BG contiguous.

example: https://i.imgur.com/7WeIdfS.mp4

isolate-2.py attached (unzip and put in plugins folder) The usual guarantee, there is none Wink

[attachment=8486]
Works nice. Thanks Smile