I'm making an animated GIF using layers in GIMP. I have an image of an equation that I want to put on the same place in each frame. I tried opening the equation in GIMP, and then copy and pasting it into my layers, moving it to the location I want using the mouse, and then anchoring it. However, it only appears on one layer and hence on one frame. I can manually repeat for each frame but then I can't get it to the exact same place in every frame. Is there a better way to do this, i.e. anchor a floating selection to all layers at once?
No - a Floating Selection is internally attached to the layer it was pasted into. I suggest you try one of the following workarounds:
1) Promote the Floating Selection to a New Layer (just press the new layer button); Position this layer; Duplicate it as many times as you want; For each duplicate, manipulate the layer stack to place it above one of your destination layers; Select "Merge down" on the layer context menus. it is possible to create a single script that would automate the steps after you position the pasted layer, or even simply automate the task from either the script-fu or python-fu consoles. But I prefer the method described bellow:
2) My personal favorite for creating animations in GIMP: work with two images - one in which you have your elements in separate layers (including your equation), which you position as you want; a second image where you will compose the animation, in which each layer will be a frame; Make use of
edit->copy visible on the first image, and
edit->paste; layer->New layer in the second image. That way, for each frame you rearrange your elements freely on the first image, and put "snapshots" of your composition as frames - more or less like producing a stop-motion animation. (use the preferences to assign easy shortcuts to "copy visible" and "paste as new layer" - if you assign easy shortcuts like, say, "1" and "2", it is really a breeze)
There's likely a faster way to do this somehow (and if I had to do this for more than a handful of frames I would have probably used
ffmpeg) but the fastest way I was able to do this in GIMP was by first, preparing the overlay as a layer, selecting and copying that layer, selecting the bottom layer in the
layers tab, pressing
Ctrl-V to paste the overlay,
Ctrl-H to anchor it, pressing the up key to select the next layer, and repeating that process (paste, anchor, next layer, repeat.) Not having to touch the mouse sped it up a bit-- even though it's still a tedious manual process.