Creating Animated GIFs with GIMP

Whilst creating some lesson slides in Google recently I wanted to add some moving images to the slides. You can see an example of one the slides I am talking about embedded below. It is a session that I delivered with Dan Aldred at the ExaBytes17 conference about using the Raspberry Pi Sense Hat.

By using the Sense Hat Online Emulator over on Trinket, I could model what the program was going to do and then use a screen recording program to capture this back to an mp4 file. On my Windows PC at work I used the Snagit software to record my screen, but at home on my Ubuntu PC I used SimpleScreenRecorder.

So once I had my mp4 video file I wanted to use as my animated GIF, I needed to convert it somehow. As I am exclusively using Linux at home, I wanted a solution which used cross-platform Open Source software so that I could use the same process both at work and at home.

First off we need GIMP installed; download and install the correct version for your operating system from their site. Once you have done that and you are happy that GIMP runs correctly, we need to add another package to GIMP; the GIMP Animation Package. You can find a pre-compiled binary for GIMP GAP for Windows here and to install GIMP GAP on Ubuntu simple type the following into your terminal:

sudo apt-get install gimp-gap

Now when you run GIMP you should see a new menu item entitled “Video…”. From here on out the steps should be the same no matter what operating system you are using!

  1. Click the “Video > Split Video into Frames > Extract Videorange” menu item
  2. Click the “…” to the right of the “Videofilename” text box and browse to your MP4 video saved earlier
  3. Click “Video Range” to preview the video that you just imported
  4. Use the slider to move the video preview to the first and last frames you want, making a note of the frame numbers
  5. Enter the first frame number you noted down into the “From Frame” box
  6. Enter the last frame number you noted down into the “To Frame” box
  7. Ensure that “Create only one multilayer image” is checked.You can see all the settings required in the image below:
  8. Click OK to create a new file in GIMP which will have your animation in it. If you get a warning about “frame.wav” already existing you can safely click “Overwrite File”
  9. To save your animated GIF select “File > Export As”
  10. Navigate to the folder you want to output to. Give the file a name appended with .gif at the end and click “Export”
  11. The “Export Image as GIF” window will then open; select “As animation” and “Loop forever” as shown below
  12. Click “Export” to save your animated GIF file

Once GIMP finishes exporting your GIF file you can then just drag and drop it onto your Google Slides to have an animated image running without the need to embed and launch videos.

 

Leave a Reply

Your email address will not be published. Required fields are marked *