logo

carol.gimp.org

GIMP 2.2

GIMP Animation Plug-in:Layers

This tutorial starts with a stack of video extracted frames and requires some knowledge of TheGIMP and TheGIMP Animation Plug-in and its Video Navigator.

Using simple layer manipulation via the animation plug-in to mask off portions of all the frames and then to add a background to each frame is the goal of this example. With TheGIMP, it is six simple jobs, add the alpha channel, add the mask, paste the mask image to the mask, add the new background layer, make sure it is underneath the main layer and flatten the image. The process will be almost the same when working with the stack of frames, each step needs to work over every frame in the stack.

To accomplish these same six steps with GAP, the tutorial will use four different gap dialogs:

  • <Image>-->Video-->Modify Layer
  • <Image>-->Video-->Move Path
  • <Image>-->Video-->Layer Delete
  • <Image>-->Video-->Flatten Frames
intro
framesmodify-1

Add an Alpha Channel

Each one of the "Frames" in this stack is actually an image. The first job that needs to be performed on each frame is to add the alpha channel. The Video -->Frames Modify dialog will do this job and is a good way to start to use the dialog. Later when there are more than one layer in each frame in the frame stack, the dialog becomes a little more dangerous. At this point in the tutorial, there is only one layer and the dialog should run fine with many of the defaults:

  1. Make sure it is running through all of the frames 1 to whatever. Sometimes if you start this from a different frame than the first one, the plug-in starts with that number in this portion of the dialog. This is good if you are only changing a few of the frames in the stack. This simple example only shows how to make the same modification to all of the frames, so this feature can be a problem.
  2. From the list of many little jobs this plug-in might be able to do as can be seen in Function. Select "Add Alpha Channel" (just below the middle of the list).
  3. Touch the [OK] button and wait for it to work.

The plug-in spits all sorts of information into the progress bar on the frame window.

Make a mask

This is my third mask for this simple task. The first mask left too much of the blue and I wanted the transition between my image and my fake sky background to be less obvious. The next mask cut off parts of the mobile in big chunks of the movie -- that mask was too small. There were a few options; I opted to start over.

This mask is going to go through some image making hocus pocus. A copy of this mask is to be attached as a new layer underneath each of our movie image frames. Then it is going to become a layer of this original image, and then the layer that got copied gets deleted. The next three steps outline this.

mask
movepath

Add a Layer to each image in the frame stack

It is good to grab a beverage or some comfort food before taking a first look at the next dialog. This dialog is able to do much much more than this little exercise needs, so just be forewarned. Make sure that the mask image is open in this gimp session and start the Move Path dialog by right clicking on the Special Frame Window and selecting Video -->Move Path ...:

  1. Select the mask image in the Source Image/Layer
  2. Switch Stepmode to "None"
  3. Make sure all frames are included.
  4. Putting 9999 here makes this the bottom most layer. Putting "1" here also would have worked. This sets your layer stack up to be numbered from the top layer down.
  5. Touch the [OK] button and wait for it to work.

What has just been accomplished can be seen in the layers dialog. A new layer has been attached to the lowest layer position in each frame in the stack. At this point, it is not looking like the typical way a layer is applied to a normal gimp image as well. The animation dialogs present a different way to do this.

layer1
framesmodify2

Apply a layer as a mask

Next, Video -->Modify Layer will once again be used to make the same layer modification to all of the images in the frame stack. This time, the dialog is going to be a little picker than the first time. There are more layers now; it might be a good time to back up your layer stack someplace so you will not need to go through all of the steps again.

  1. Make sure From Frame: and To Frame: have all of the frame images between them.
  2. Toggle "Pattern is a list of reverse layerstack numbers." in the Layer Selection list.
  3. Since we made the new layer "0" in the "Move Path" step, set the Layer Pattern to work on layer 1 in each frame in the stack.
  4. The Function: for this Frame Modify run is to "Copy layer mask from layer below" an option found at the bottom of the Functions list.
  5. Touch the [OK] button and give the modification some time to work.

Check in the layers dialog to see if the layer was successfully applied. The frame image in the special image window will not look so good at this step since the layer that was used as the mask is showing where the original layer is transparent. The next step is to delete this layer.

layer2
deletelayers

Delete a layer

Knowing that image frames were forced to have layer numbers starting at the top with 0 and working up through the numbers as you count down through the layers, the layer called 1 needs to be deleted. Change the Layerstack: number from 0 to 1 and touch the [OK] button. Check it in the layers dialog to see if the correct layer is deleted.

Make a new background

Classic gimp tools and dialogs were used to create the new background for this movie. The gimp color picker to get the colors from the sky and the gimp gradient editor to spread those colors out similarly.

Classic gimp tools and dialogs were used to create the new background for this movie. The gimp color picker to get the colors from the sky and the gimp gradient editor to spread those colors out similarly.

newbackground

Add the new background image as a layer

Using the Video -->Move Path dialog the exact same way as it was used to add the mask layer; add the new sky background image to each frame in the stack. Make sure that the new background image is open on in this gimp session for the plug-in to be able to use it.

flattenframes

Flatten all of the frames

This step is actually not required. The Master Videoencoder handles that for you.

One uncomplicated dialog does this. Select Video -->Flatten Frames and touch the [OK] button.

This step should complete all of the layers manipulation I did on the frame stack from the movie. All that is left to do is to find some sound and re-encode this for a standard player or something else if this does not exist.

GAP Layers Manipulation

In this tutorial, several frames in an extracted movie were manipulated using the Layers Modify, Layer Delete, Move Path and Flatten Frames dialogs from TheGIMP Animation Plug-in. In future tutorials, the sound needs to be changed and the whole thing re-encoded to play on other computers.

oneframe

another-gnu-type-sm

Most all of my software is gnu. thanks!

Creative Commons License

This work is licensed under a Creative Commons License.