Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Make GIF background transparent
#1
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.
Reply
#2
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


Attached Files
.zip   c2a-all-layers.scm.zip (Size: 677 bytes / Downloads: 410)
Reply
#3
Thanks, this is the base GIF

While most of it worked well, it also removed the white inside the character.


Attached Files Image(s)
   
Reply
#4
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.
Reply
#5
No problem. Thanks Smile
Reply
#6
(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).
Reply
#7
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
   

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

   
Reply
#9
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

   


Attached Files
.zip   isolate-2.py.zip (Size: 472 bytes / Downloads: 76)
Reply
#10
Works nice. Thanks Smile
Reply


Forum Jump: