Animated GIFs are image files containing two or more images that a Web browser or other program flips through to simulate the effect of a motion picture. Making an animated GIF involves writing program code that reads each particular image from its containing GIF file. It also involves converting each image's data, which is encoded in the GIF format, to the output format needed by your monitor. Making an animated GIF program offers several benefits, including the opportunity to fit the program to your specific needs. For example, you could add a control to change the playback speed.
- Skill level:
- Moderate
Instructions
-
1
Download and run several existing animated GIF programs whose source is freely available. (Such programs are called open-source programs.) Examples include "APNG from GIF" and "Web Video to GIF."
-
2
Download the source code for one of the programs, and any documentation with the code. The documentation, which tells you how to "build" (compile) the program, will refer to the language in which the program is written.
-
3
Install a development kit for the programming language noted in the documentation. If the language is C, you can install a free C compiler from the GNU Compiler Collection page. The official Java development kit (JDK) is available from Oracle's JDK download page.
-
4
Open, one by one in a word processor or integrated development environment (IDE), each of the source files of the program. Print and read each source file's statements, especially any comments written by the developers.
-
5
Compile the program using the instructions that came with the downloaded source files. Run the program to make sure you've compiled it correctly.
-
6
List changes you'd like to make to the program. For example: "The program doesn't display the images quickly enough, which produces a choppy motion. Make the frames flip faster."
-
7
Create, in your word processor or IDE, a new set of source files with the same names as the originals. Type the statements for each source file from the printouts you made. This task will require an intensive reading of the source code, which will shed light on the program's workings.
-
8
Recompile and run the program. If it displays any unusual behavior, trace through (debug) the program, referring to the documentation for detailed instructions. Continue to the next step only after fixing all program errors.
-
9
Copy, in Windows Explorer, the original set of source files to another folder to duplicate the files. This step ensures you have a working copy of the program.
-
10
Delete one of the source files, then retype it from memory. Read the original source file printout only as needed. Retyping the source code should further your understanding of the program's algorithms.
-
11
Repeat the previous step until you can type the source file without referring to the printout. Verify your knowledge of the code by recompiling and running the program.
-
12
Type the remaining source files from memory, just as you did the first. This task should build the programming literacy you need to customize the program.
-
13
Write the source code for the simplest change in the list you wrote in step 6. Recompile and run the program, then perform any debugging as needed.
-
14
Write the code for each of the remaining items on your change list, working from the simplest to the most complex change. Completing this task will tailor the animated GIF program to your design specifications.