Saturday, April 23, 2011

HOW TO CREATE ANIMATED GIFs FROM VIDEO FILES

Despite the ubiquity of online video, they’re still not as portable as images, and what better way to get the best of both worlds than through animated GIFs?

You’ll need two programs: VirtualDub and Photoshop (or GIMP), which will each cover half of the process: extracting images from a video file, and turning the images into a frame-by-frame animation.


Create the image sequence using VirtualDub


 1) Open video file (you may need to install the appropriate codecs).

 2) Mark the start and end of the scene you plan to extract using Edit > Set Selection Start / Set Selection End or the last two buttons in the playback toolbar labeled Mark in / Mark out. Use Clear Selection if you want to start over.

 3) Before exporting, you may want to adjust the number of frames exported by going to Video > Frame Rate… Select Process every third frame (decimate by 3) or enter a custom number.

 4) Select File > Export > Image Sequence… and click OK.

 5) You might notice that you can also export the selection as an animated GIF under the same menu, but if you want better control over the size and appearance of your GIF, Image Sequence is the way to go.



Create the animation using Photoshop

 

 1) Open the Animation panel and make sure it's set to Frame Animation.

 

 2) Select File > Scripts > Load Files Into Stack and select all the exported images in the proper order. Make sure the images are in the correct order (the last file usually shows up on top, so send it to the bottom).

 

 3) Create a new frame for each layer by selecting the Duplicates selected frames icon or the New Frame item in the panel menu. Hide the current layer, then select the next one below it. Repeat this until you’ve made your way all the way to the last layer.

If you have a lot of frames, you can record a Photoshop action that goes:

                    
                a) Duplicate current animation frame
                b) Hide current layer
                c) Select backward layer (this isn’t easy to record so, follow the instructions for creating that step on this page).

Now hit Play until you reach the last layer.  

 

 4) Tweak the animation settings accordingly. You may want to set a short delay for each frame, and choose whether your GIF will loop once, thrice, or forever.

 

 5) Crop, resize, and do all your image effects.

 

 6) Select File > Save for Web and Devices… and select GIF. Tweak the color range, dithering, and other necessary settings.

 


Photoshop alternative: GIMP

 

1) Select File > Open as Layers… and select the images.

 

2) Select Filters > Animation > Playback to preview your animation. You can also select Optimize to, well, optimize.

 

3) Select File > Save As and make sure GIF image is selected under Select File Type.

 

4) Choose Save As Animation in the next dialog the shows up then click on Export.


5) In the Save as GIF dialog, check the following: 

                   - Loop Forever

                   - Use delay entered above for all frames

                   - One frame per layer

                   - Use disposal entered for above for all frames

 

    Set the Delay between frames where unspecified to something low like 10 milliseconds. 

 

 

Did it work? Leave me a comment!

31 comments:

  1. known about this for a while now, but bookmarking for future reference.

    thanks for post

    ReplyDelete
  2. I always wondered how to make GIFs, thank you kindly

    ReplyDelete
  3. Dude, I've been looking for a tutorial like this forever. I feel silly for not knowing how to make .gifs ...

    ReplyDelete
  4. I always do it with a long tedious process involving flash, thanks man

    ReplyDelete
  5. I've made couple of gifs by joining few pics together, but never knew about the VirtualDub movie-to-gif. Very nice tutorial and your other blog content is awesome. Looking forward to more such tutorial, etc!

    ReplyDelete
  6. That's a very useful guide, my old method was way too complicated

    ReplyDelete
  7. Thank you, I've actually been wondering this for a while.

    ReplyDelete
  8. i think there are easier ways but thanks for sharing anyway

    ReplyDelete
  9. This is very helpful. Thanks!

    ReplyDelete
  10. Thanks, always wondered how this was done!

    ReplyDelete
  11. amazing tutorial bro,i used to animated GIFs with imageready all the time,waiting for more

    ReplyDelete
  12. Some very useful info here. Thanks.

    ReplyDelete
  13. That's pretty useful. I've made gifs in the past to send to friends (nothing like a big giant flashing thing to warm somebody's day up), but I'll have to try it this way.

    ReplyDelete
  14. Nice post, I've always wondered how it is done.

    Interesting blog. Following =)

    ReplyDelete
  15. Always wanted to know how to do this! Thanks!

    ReplyDelete
  16. Thanks, never knew how to do this till now. Will try it out!

    ReplyDelete
  17. you just fixed my boring sunday

    ReplyDelete
  18. Really really helpful tutorial, thanks man. I'll definitely check this blog often.

    ReplyDelete
  19. Man, i'm no neophyte but i've never been able to figure out how to make a GIF without using some slow website. Let me see if this works out, if so, thanks a ton man.

    ReplyDelete
  20. This info will come in handy, thanks for the tip!

    ReplyDelete
  21. What a wonderful tutorial! When I became interested in the background videohas understood that I wanted to create vj loops so you could not advise the guide to create them?

    ReplyDelete