Grasshopper

algorithmic modeling for Rhino

Animated gif encoding within grasshopper

gifmaker.gh

Despite the age of the format, gifs remain a popular and very widely supported way to share small animations. The slider animation function in Grasshopper makes it easy to turn definitions into a sequence of images, but until now you still needed some additional software to actually turn them into playable animations. I used to use VirtualDub for this, but felt it would be nice to be able to do this quicker and without leaving Grasshopper.

The attached component lets you simply specify the filepath of the first frame in a sequence, choose a framerate, then it automatically finds the consecutive images and compiles them into an animated gif.

...and since I'd hate for this to lead to a flood of oversized files - remember, one of the things that makes animated gifs so nice is that they can load and play quickly almost anywhere, but this advantage is lost if the files are too large. When creating your slider animation frames, choose a small resolution, and don't make too many frames. 50 frames at 400x300 pixels is often plenty. If you do want to make something epic and hi-res, stick to a proper modern compressed video format.

Enjoy!

Views: 7851

Comment

You need to be a member of Grasshopper to add comments!

Join Grasshopper

Comment by Andy Murray on November 16, 2022 at 10:55pm

I think the idea of Animated gif encoding is a good one, but I think it needs to be done in a very clear and concise way. I would also like to see a way for you to set the quality of your animation. Go to eyeglass repair nassau county for best ideas. I think it's great that you can add multiple images in one file, but it should be easier to do this with grasshopper. The current process involves creating a new project, adding the images and then adding them as layers.

Comment by Andy Murray on October 25, 2022 at 4:06am

Grasshopper is a free and open source web design tool. It allows you to create websites and interactive documents with a drag-and-drop interface. One of the cool features is that it can encode animated gif images into pages. You should try Disinfect VR for best VR. This makes it easy to create an interactive experience online by embedding an animated gif image into your website. Before we show you how to do this, let's talk about the different types of animated gif images available in grasshopper.

Comment by Daniel Piker on October 18, 2016 at 10:11am

Hi AJ - do you have your still images saved with names like "name_001.png","name_002.png" and so on?

Also - don't use numbers in the first part of the file name like "animation4name_001.png" or it will get confused trying to find the sequential files.

Comment by AJ on October 18, 2016 at 8:38am

not working for me

any ideas why?

i get 1kb gif file from the compiled images (from some reason it take a micro sec and say its done)

thnx

Comment by Vicente Soler on March 30, 2016 at 4:21am

It becomes disabled on purpose. To run it again you just have to enable it and it will disable itself again at the end. I prefer this method for scripts I want to run manually over having a boolean input. If you use a boolean toggle you might forget to turn it off, if you use a button it's not guaranteed it will only run once with the input as true.

Comment by Daniel González Abalde on March 30, 2016 at 3:53am

Awesome Vicent,

I had to look up the references anyway. They are (.net 4.6) WindowsBase.dll, PresentationCore.dll and System.Xaml.dll. For some reason the script remains blocked and there are not changes in the viewport, but generates the gif! Really fast! Thank you.

Comment by Vicente Soler on March 30, 2016 at 2:20am

Based on this idea, to make things even quicker, attached is a scripting component that replaces the slider + animation function and saves a gif directly without generating the intermediate frames (they are only stored in memory).

Rather than adding the code to generate the gif (as in Daniel's script) I used a built in C# class for this, but it's probably worse. First, you can't set a custom delay between frames for some reason (the WinRT analog of this does support it). Second, you'll have reference the required assemblies. If you have the latest .NET framework, hopefully they are in the same folder path as in my computer so you shouldn't have to relink them.

gifslider.gh

Comment by Igor Mitrić Lavovski on March 26, 2016 at 5:15pm
Great! Thanks!
Comment by I_M_F [Iker Mugarra Flores] on March 24, 2016 at 2:08pm

super cool!

Comment by Pieter Segeren on March 24, 2016 at 1:41pm

Very handy :) Thank you Daniel.

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2022   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service