Alpha channel when making webps in GIMP

Hi, I’ve been using GIMP for a really long time, but I’m expert at nothing. I like making animations and have been in GIFs. I’ve discovered webps and that I can make them and edit them in GIMP. I’ve run into a problem using alpha channels. If I create animations using alpha channels it works fine if I make it into a GIF but doesn’t if I export it as a webp. Each layer completely obscures the previous layer when it shouldn’t. Is this something GIMP doesn’t handle yet or am I doing something wrong? Thanks a bunch.

A question on animated webp images may help. Note that some image viewers get webp animations wrong. Check in a recent build of Chrome.

Thanks, I’ll try some others. I usually use Irfan view.

I’d never heard of webp before but I just tried this out and I think that it’s supposed to work this way. If I have several layers in a GIMP image, with or without transparency, and I export them as an animated webp file, then each image is displayed consecutively. They are not composited. When I view the resulting file in Firefox, there’s a white background for the images with transparency.

If you want to composite layers with transparency, then I think it would be better to export them as separate images and then create the animation from the separate, composited images. This is what I do. If you want, you can use a single GIMP image and then make only the layers you want visible when you export an image in another format. Or you can use multiple GIMP images. It doesn’t matter, there’s no difference in the result.

I usually use PNG, but it doesn’t matter what format you use. I also usually use either Flowblade to make the animation from the exported images or occasionally ImageMagick in combination with a shellscript.

1 Like

Just in case you’re interested, here are a couple of examples:

This an image that I composited in GIMP the way I described:
It has a layer each for the background, the outlines and the different colors. All of them have an alpha channel except the one for the background. It’s like a stack of cels in traditional animation, but with no darkening due to incomplete transparency.

In this animation:
starting 8 seconds in and continuing for 6 seconds, the lettering is on separated images with alpha channels, overlaid onto the opaque background. I used GIMP for the compositing and Flowblade to create the animation.

:grin:Thanks. Great work mixing the audio in. I’ve done some of that.

You’re welcome.

Thank you.

Then you know what a pain in the neck it is to get the audio and video synchronized.

I’ve used VideoPad to assemble them with some success.

Thank you for the tip. I’ll take a look at the website. I think it would be difficult to do no matter what, especially since I never use a click track.

A problem I’ve had is that I can’t see any way to slow down the playback speed in Flowblade. That would make it a lot easier. However, I’ve heard that if all else fails, reading the manual can sometimes help. I’ve also thought about making using separate tracks for the audio. That should make it easier to see the peaks. So far, I’ve always mixed the tracks down before importing them into Flowblade.

Works for me exporting a Webp with transparent layers with (combine) produces the expected result.

In any case, using Filters > Animation > Unoptimize will create the equivalent animation with complete frame replacement from which you can create a WebP that will work correctly everywhere (adn strangely in my case, is also smaller).

1 Like

How does this work exactly? Is “combine” an option and what is the significance of the syntax with backquotes and parentheses? Sorry, but I haven’t run across that before. A “combine” option doesn’t appear anywhere in the “Export” menu when exporting webp.

I just tried again with an image with three layers and three colors. I made one color opaque in each layer and made the background transparent in all the layers. I then exported the image as an animated webp file. The result was the same as what I had before when displayed in Firefox: Each frame had the contents of a single layer with a white background.


I’m thinking edit the layer where it gives time duration put (combine) next to that. I’ll try it when I have a chance. It works! However you have to edit every layer to use this method. I pasted the “(combine)” to save time. Using the filter drop down method adds (replace) to each layer, so if that works it’s much simpler.

Yep, using (combine) did the trick. Thanks Ofnuts. Now I’ll try and figure out that other method you mention.

If the name of a layer contains:

  • (combine): the layer contents are added to the next frame
  • (replace): the layer contents replace the whole image

In addition a second pair of parentheses can indicate a display time (200 ms).

Filters > Animation > Optimize (for GIF) takes a stack of layers and replaces the (replace) layers by the difference with the previous layer and sets it to (combine). In other words, it replaces (replace) layers by equivalent (combine) ones. This is a poor man’s delta-encoding (but if can be quite efficient).

Filters > Animation > Unoptimize does the opposite and replaces cumulative layers by layers that represent the full state of the animation when that frame is played. (replaces (combine) layers by equivalent (replace) ones).

1 Like

Thanks, I’m trying that. When I do that retroactively it creates a duplicate version with the new settings so you don’t lose anything.

Success! Works perfectly. Thanks alot.

Thank you for the explanation. I haven’t gotten around to reading up on the animation features of GIMP, partly because I think it would be difficult to work with a large number of layers in a single image. At 30 frames per second “on twos”, a 10 second animation would already require 150 layers.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.