Before we begin you will need to install a script we will be using for this tutorial. I cannot remember where I got it from but I believe the original author's name is
Federico Mena Quintero. His script was modified by someone else whose name I do not know. In any case I could not find a link hosting this script so I am hosting it myself. You may
download it here, by right clicking the link and choosing
save link as from the context menu. If you have never installed a script for the Gimp before you may want to consult
gimptalk.com's FAQ to find out how.
This is optional and if you are on a Mac there is no available version of the GAP for you to install. You do not need to use the GAP for this tutorial but I highly recommend it. The GAP is the animation package for the Gimp and will make animating our progress bar a snap. You can download the latest version of the GAP for
windows here, if you are on a Linux distribution check your software repository or grab the source from
gimp.org.
Skill level required to complete this tutorial:
You will need to have a basic understanding of the tools palette and options, layers dialog and options, the context menu and sub menus. If you do not have a basic understanding of these things then I would recommend the following reading to familiarize yourself with the Gimp's basic tools and functions.
Learn Full Gimp Interface In Half An Hour
Gimp User Manual
Terminology
When ever I want you to press a keyboard combination at the same time, I will use the + sign to indicate I want you to press them together. For example ctrl+shift+a indicates I want you to press the
ctrl keyboard key, the
shift keyboard key, and the
a keyboard key at the same time.
When ever I refer to the context menu I am referring to the menu's that are activated by right clicking a selected area, or in some cases the menu across the top of the image window. See figure
T-1 for reference.
T.1 The image windows context menu.
When ever I refer to right clicking the layers dialog and selecting from the context menu I am referring to the context menu shown in figure
T.2
T.2 The layer dialog context menu.
Things you will learn from this tutorial
You will learn how to create a border with a shadow, how to add a basic highlight, basic script and filter functions, basic GAP functions and usage and of course how to create a animated progress bar.
Section 1 creating the progress bar
Open a new image 200px x 20px is the size I will be using. You may make yours what ever size suites your needs. The background color needs to match the space you are planning to use your progress bar for, I will be using white (#ffffff) for my background.
Now in the layers dialog create a new transparent layer on top of the background layer, name this layer border. See Figure
1.1
1.1
Now press the ctrl+a this will select the whole area, transparent and alpha of the border layer. Next from the context menu located in the image window, or you can activate it by right clicking anywhere on the image area, choose
Selection>Rounded Rectangle use the setting shown in figure
1-2 then press ok.
1.2
Now select your border color from the colors dialog, I have chosen #424242 as my border color. Now fill your selection with the color you have chosen using the bucket fill tool.
[NOTE]
Note:
Did you know that you can click drag and drop colors from the foreground or background colors and palette's dialogs directly into your selections with out switching to the bucket fill tool?[/NOTE]
Once you have filled your selection choose
Selection>Shrink Selection from the context menu and adjust your settings as shown in figure
1-3 and press ok.
1.3
Now press ctrl+k (For Gimp versions higher then 2.2 press the del key) to clear the selection. Once you have cleared the selection choose from the context menu
Selection>Grow Selection and grow the selection by 1px.
Now from the layers dialog with the border layer selected choose the duplicate layer button and duplicate the border layer and rename it border shadow, then place it below the border layer. See figure
1.4 for reference.
1.4
Your selection should still be active at this time. With the border shadow layer selected choose from the context menu
Filters>Blur>Gaussian Blur and adjust the setting to look like figure
1.5 and then press ok.
1.5
Now form the layers dialog adjust the opacity for the border shadow layer to look like figure
1.6
1.6
Now press ctrl+shift+a to release the selection. If the border shadow is to your liking then you may right click on the border layer and choose merge down from the context menu, If not to your liking then play with the opacity settings and/or the layer mode until you have the effect you are looking for then merge the two layers. Once you have them merged rename the border shadow layer back to border.
From the layers dialog create a new layer named bars 200px x 20px. You should now have three layers in the layers dialog, be sure they are in the same order as shown in figure
1.7
1.7
With the newly created bars layer selected press ctrl+a to select all, then from the context menu choose
Selection>Shrink Selection and adjust your settings to look like the ones shown in figure
1.8 and press ok.
1.8
From the colors dialog set your foreground color to the color you want your indicator bars to be, for this tutorial I have chosen #00af00. Once you have the color you want click drag and drop or use the bucket fill tool to add your color to the selection.
[NOTE]
Note:
Did you know pressing
ctrl+, will fill the current selection with the foreground color and pressing
ctrl+. will fill the current selection with the background color? [/NOTE]
Now create a new layer above the bars layer and name it bars highlight. With the bars highlight layer selected change the layer mode to screen as shown in figure
1.9.
1.9
Press d on the keyboard to rest the foreground and background colors to default, then press x on the keyboard to switch the foreground and background colors so that white is in the foreground, then press L on the keyboard to activate the Gimps Gradient Tool. From the tools dialog adjust your setting to look like figure
1.10.
1.10
[NOTE]
Note:
Did you know if you need to bring up the options for a specific tool you can do so by double clicking the tool from the tools palette? If you have the tools options already open in a docking window double clicking the tool from the tools palette will bring the options to the forefront.[/NOTE]
Zoom in on your image, then on the bars highlight layer with the left mouse clicked at your starting point press ctrl to snap to grid and then drag the Gradient tool down only a few px maybe half way through the image in a straight line and release the left mouse button. See figure
1.11 for reference.
1.11 Zoomed in 400%
If the highlight is not in the exact location you want it to be then press m on the keyboard to activate the move tool. Then use the arrow keys on the keyboard to move the highlight up or down to the position you want it to be. See figure
1.12 for a reference.
1.12 Zoomed in 400%
With the bars highlight layer selected adjust the opacity from the layers dialog to what ever looks good to you, I choose to reduce the opacity to 50%.
Now from the layers dialog merge the bars highlight layer down to the bars layer. From the context menu choose
Script-Fu>Alchemy>Erase every n-Row... This is the script you installed at the beginning of this tutorial. Adjust your settings to look like the ones in figure
1.13 or if you want narrower or wider progress bars you can play with the settings until you have the desired effect, then press ok.
1.13
Create a new layer and name it slider, then with the new slider layer selected press ctrl+a to select the whole image. From the context menu choose
Selection>Shrink Selection and adjust your settings to look like the ones in figure
1.14.
1.14
Now fill the selection with the same color as you background, I choose #fffff. Press ctrl+shift+a to release the current selection, then from the context menu choose
Layer>Autocrop layer. Now merge the bars layer down to the Background layer. You should now have three layers in the layers dialog in the exact same order as shown in figure
1.15.
1.15
Now GAP users may now skip ahead to section 3. Non GAP users go to Section 2. If you are planning to try Section 3 then you should save copy of your work, I saved mine as pb,xcf. I strongly recommend is saving your work in the Gimps native format which is
.xcf file format.
Section 2 layer animation
If you are not planning on trying Section 3 then you can skip saving a new copy of your work. Snice I need a copy for the next section I will save a working copy for this section and leave the pb.xcf for Section 3. To do this choose
File>Save as from the context menu and save your work as
pg2.xcf. This will leave pb.xcf as is and create a new copy pb2.xcf for you to work within this section.
Now you need to decide how many pixels you want the slider layer to move across the bars to create your animation effect. The overall image width is 200px. I setup my slider layer to move across the bars 10 pixels per frame. This means in order for the slider so move from start to finish I will need 20 frames. Now that I know how many frames I need for my animation I need to create them by duplicating the slider layer 19 times.
See figure
2.1 for reference.
2.1
Now you need to create a reference on the image so that you know where to place each of the slider layers. Setting up a grid is perfect for this task. Choose from the context menu
Image>Configure Grid and adjust your settings to look like those in figure
2.2 then press ok.
2.2
Now from the context menu choose
View>Show Grid you should now have lines across your image in 10 px interval. Before you begin moving the slider layers into place choose from the context menu
View>Snap to Grid, this will force your layers to snap to the grid lines when you move it close which will speed up moving the slider layers into place.
From the layers dialog left mouse click on the layer named slider copy#18, once you have selected the slider copy#18 layer press and hold the shift button on your keyboard and click the eye next to the slider copy#18 layer in the layers dialog. This will make all the other layers in the image window invisible and will make it much easier to see where you are moving your active layer to. See figure
2.3 for reference.
2.3
With the slider copy#18 layer selected from the layers dialog click the image window to make it active then press m on your keyboard to activate the move tool. Now left mouse click on your image and drag it to the furthest grid line on the right side of your image. See figure
2.4 for reference.
2.4
Now work your way down the layers clicking the eye to activate the layer then use the move tool to move the layer to the next closest grid line until you get to the layer named slider which you should not move, it is already in the proper place. At this point all the slider layers should be active and moved into its place it is now very import that you save your work,
YOU MUST SAVE IT AS A .XCF FILE.
From the layers dialog select the Background layer and duplicate a Background for each slider layer (19 layers all together). Then merge each slider layer to it's corresponding Background layer. Once you have them all merged you should have the border layer and 19 Background layers. Make sure they all are all named Background or Background copy#, and none of them are named slider. If you have some named slider or slider copy# you made a mistake and need to correct it before continuing. See figure
2.5 for reference.
2.5
Repeat the above steps for the border layer this time duplicating and merging down to the Background layers. Again before you move on make sure all the layers are name Background or Background copy# if any of them are named border or border copy# then you have made a mistake and need to correct it before going to the next step.
Again at this point it is very import that you save your work,
YOU MUST SAVE IT AS A .XCF FILE.
Once you have saved your work as pb2.xcf the next step will be experimental. Since we can not see the frame rate before saving the image as a .gif we will need to guess at the rate to use. by saving your work first in the Gimp's native .xcf file format we now have a copy we can reuse with out having to start over. From the context menu choose
File>Save as.. and save the file as pg.gif and press save. See figure
2.6 for reference.
2.6
This will bring up the export image dialog, adjust your settings to look the same as figure
2.7 then press the Export button.
2.7
This will give you an error message about parts of the layers extending beyond the boundaries of the image. You may ignore the error and press ok. The Gimp will then automatically clip the layers to the image size. Once you press ok you will get the Save as GIF dialog. This is where the experimenting part comes in. We will be adjusting the _Delay between frames where unspecified option. See figure
2.8 for reference.
2.8
I choose 110 ms then click ok.
From the context menu of the pb.gif choose
Filters>Animation>Playback, this will bring up the playback dialog and you can view your animation. If you are not happy with the frame rate (the speed of your animation) go through the save process again and change the 110ms, the lower the number the slower the animation the higher the number the faster the animation. Keep doing this until you have the frame rate you are looking for. When the frame rate is to your liking then you can reduce the file size by choosing from the context menu
Filters>Animation>Optimize (for gif). This will create a new optimized version of your animation. This is your finished animation, you can close the original pb.gif then save the new one pb.gif replacing the original and you are finished. If you have a version of the Gimp that can use the GAP plugin but have never taken the time to install it you may want to check out section 3 to see how powerful the GAP is when it comes to animations.
Section 3 GAP animation.
If you have skipped Section 2 layer animation then your are probably already familiar with the GAP if you completed Section 2 and want to see what the GAP can do for your animations then your in for a surprise. The GAP will make the last section look ridiculously long and tedious.
If you do not have pb.xcf open then open it now, pb.xcf should contain 3 layers border, slider, and Background.
The next step is to separate the border layer and the slider layer into its own image. To do this choose the slider layer from the layers dialog then choose from the context menu
Edit>cut, the slider layer will disappear from the layers dialog. Now from the context menu choose
Edit>Paste as new, this will create a new untitled image with the slider layer, you will need to rename the pasted layer to slider.
Now repeat the steps for the border layer, select the border layer from pb.xcf and then
Edit>cut only this time click on the untitled image window and choose from the context menu
Edit>Paste into, this will paste the border layer into the untitled image, you will need to rename the pasted layer to border. You should now have two layers in the untitled image, border, and slider, and one layer named Background in the original pb.xcf image.
Now create a special folder somewhere on your hard drive. Mine is
progress-bar-animation in my home directory but you can name your what ever you like. This is necessary to keep track of the frames that the GAP will create. Now save the original image into the newly created directory using the following format pb_000001.xcf anything in front of the _ underscore can be what ever you choose however everything including the _underscore must be exactly as I have it in my example, this will be the first frame of your animation. Now save the untitled image into the same directory name it anything you want but it must be in the Gimps native .xcf file format, I named mine items.xcf.
Now we are ready to call the GAP and create our animation. With both items.xcf and pb_000001.xcf open choose from the context menu of the pb_000001.xcf
Video>Duplicate Frames.. this will open the duplicate frames dialog. Adjust your settings to look like figure
3.1 and press ok to duplicate our background image for each frame of our animation. If you want 20 Frames for your animation then you will need to duplicate the first frame 19 times.
3.1
The top two options are needed for more complicated animations, since our animation only has the one background we only need to adjust the N times: option.
Now that you have your frames you can begin adding the items to your animation. From the context menu choose
Video>Move Path and adjust your settings to look like figure
3.2. Then press Add Point to set your first control point.
3.2
Now change the X option to 201, See figure
3.3 for reference.
3.3
Now press the Anim Preview and adjust your settings to look like figure
3.4 then press ok to preview the changes you just made.
3.4
If the playback looks as expected then you can close the playback dialog and close
with out saving the untitled image the Anim Preview created and finally press the ok button in the move path dialog.
I think at this point I will take the time to explain some of the settings you have just changed.
Source Image/Layer
This is the where you choose the layers or images you will be adding to your animation in the above example we are using the slider layer as the Source Image/Layer.
Step Mode
This setting tells the GAP how to handle the Source that we are adding. For this animation we will choose none because we want to move the slider layer only.
Handle
This option tells the move path where to start on the image. For this animation the default which is the upper left hand corner of our image will work fine.
Current Point
Displays the current control point, when you add a control point the counter moves to the next control point.
X is the current horizontial position of the Handle.
Y is the current vertical position of the Handle.
The Source Image/Layer is anchored to the Handle and moves to the current position of the Handle.
Add Point
Records the current Handle position.
Instant Apply
Allows you to preview your animation in the move paths preview window.
Frame From & Frame to
Sets the frame range you want to add your Source Image/Layer to. In our animation we are using all the frames as our animation range.
Anim Preview
Clicking this will allow you to create a untitled image to preview the current settings before you record the changes to your actual animation.
ok
Pressing this records all the control points and adds the Source Image/Layer to each frame moving between each control point at the specified frame rate
You will now notice when looking in the layers dialog of pb_000001.xcf that you now have two layers, Background and slider.
Now to add our border to the animation, choose from pb_000001.xcf context menu
Video>Move Path and adjust your setting to look like figure
3.5.
3.5
Because there is no movement you do not need to preview it if you do not want to, you can just press the ok button and record the border layer to each frame of your animation. You should now have there layers in the layers dialog of pb_000001.xcf, border, slider, and Background.
Now choose from the pb_000001.xcf context menu
Video>VCR Navigator and adjust the settings to look like figure
3.6.
3.6
Press the play button to preview the frame rate, if you are happy with that frame rate then close the VRC Navigator if not then you can adjust it until you have a frame rate you like. Once you have set the frame rate choose from the pb_000001.xcf context menu
Video>Frames to Image... Keep the default settings and press ok.
This will create a new untitled image that contains the animation frames converted into layers. See figure
3.7
3.7
Now from the untitled image context menu choose
Filters>Animation>Playback... If you are happy with the results then close the Playback dialog and choose from the untitled context menu
Filters>Animation>Optimize (for gif)... This will create a new untitled image optimized to be smaller file size. Save this image as pb.gif and that is it you are finished..........
I hope you found this tutorial useful. If you have any questions or find some errors post them to this thread and I will address them.
swmiller6