4

I have the following gif, how to make the grey background transparent if not white?

enter image description here

2

It depends if the light gray things are shadows or not.

They are shadows

Then a transparent background is not doable for this particular GIF. When you want a transparent background, you want to be able to show the picture over any background. In the picture above the shadows would be implemented as partially opaque pixels, that would slightly darken the pixels of the background. But in a GIF, there are no partially opaque pixels, they are fully opaque or fully transparent, so you can't have shadows. You can however change the background:

Prerequisites: Download and install:

Then:

  • Remove the optimizations: Filters>Animation>Unoptimize. This create a new image, you can close the source one.
  • Change image to full RGB: Image>Mode>RGB
  • Colors>Color to Alpha All layers and remove the background (color-pick, it should be #EEEEEE). Dark grey can darken to black, but don't panic.
  • Add a layer filled with white (or your new background color). Make it invisible
  • Image>Interleave layers>Interleave single layer (sprite mode) and select the white layer. This will create a new image, use Filters>Animation>Playback to check it.
  • Filters>Animation>Optimize (for GIF)
  • Export as GIF, don't forget to tick the animation checkbox, and to force all frames to 40ms (the optimization sets a longer interval)

keep partially opaque shadows

They aren't shadows

So the light gray things will remain opaque, and we want to remove the background but prevent Color-to-alpha to change the light gray things into be partially opaque pixels. For a single layer, that means Select the background,Select>Growby two pixels, andColors>Color to Alpha` but this will be long for 68 layers. However there is a script that makes this a bit faster if used right:

Prerequisites: Download and install:

  • ofn-erase-background

  • Remove the optimizations: Filters>Animation>Unoptimize. This create a new image, you can close the source one.

  • Change image to full RGB: Image>Mode>RGB
  • Set Gimp background color from the background color of your image (#eeeeee)
  • Set the tools to the "By Color" selector.
  • Click in a corner of the top layer, this should select the background
  • Layer>Erase background should make the background transparent.
  • Warm your fingers and do 67 times:
    • Click a layer in the Layer list
    • Clear near a corner in the image
    • Ctr-F to reexecute Layer>Erase background
  • Filters>Animation>Playback to check
  • Filters>Animation>Optimize (for GIF)
  • Export as GIF, don't forget to tick the animation checkbox, and to force all frames to 40ms (the optimization sets a longer interval)

opaque shadows

  • A better solution (from here) using ImageMagick -transparent is convert file.gif -transparent white -fuzz 10% file-2.gif. You could use "#ededee" to specify the color in hexadecimal. – Pablo A Mar 28 '18 at 5:55
2

I'm thinking maybe something like Online image editor would be good enough for this.

The transparency removal page is behind the Wizards tab. enter image description here

They have a tutorial on this too

enter image description here

enter image description here

2

Open the GIF in GIMP, and click Filter > Animation > Unoptimise. This will make the following tasks a bit easier.

Go through each layer starting with the top one.

  1. With the Select by Color tool, select the grey background. Note: you may have to adjust the Threshold setting in the tool options to get a good selection.

  2. Press Delete

  3. Hide the layer in the layers panel by clicking the eye icon next to it

  4. Select the layer underneath

  5. Repeat steps 1 to 4 for every layer. There are 68 frames, so it shouldn't take too long.

  6. If you want you can crop the image a bit with the crop tool, to save all the wasted space, and keep your file size down a bit

  7. When you have finished, click File > Export As, choose GIF as the file type, and hit Export

  8. When the GIF Export dialog opens, choose all the settings as below. Note the delay shown is the same delay as the original GIF.

enter image description here

1

For a Gimp

Right click the image and go to LAYERS then ADD ALPHA CHANNEL. This create the transparency beneath all layers you will have.

Right click on the image again and go to SELECT --> BY COLOR. Click on the color in the image you want to remove.

With right click to EDIT --> CLEAR.

Save as GIF.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.