Create GIF with .png with Dynamo python script

I am exploring the possibilities of creating animation through Revit with Dynamo and then automatically creating a GIF. I start by creating frames and taking pictures in sequence for the desired movement. I have been trying to create a Python script to make the GIF automatically for me, but I’m not able to make it work. I am new to Python scripting and hope anyone can help me.

Hi @eysk46551 ,

I don’t know exactly what is going on in your Python script but you’re doing some key elements wrong:

  1. You have defined a function which expects 1 argument, but when you call that function you don’t specify any.
  2. Your inputs are iteration, file_path and directory_path but I don’t understand why you have all those and what they should be used for. Isn’t a directory path enough?
  3. For some reason you’ve included the ‘if main == main’ part in this code, why?
  4. Are you sure both those Python packages are included in Dynamo IronPython2.7? I have never heard of both packages and I doubt they could be used OOTB in Dynamo.Which raises another question: why do this in Dynamo? It’s probably easier to first generate all images and then run a standalone Python script to create a gif from that. You could execute that .py-file from within Dynamo so that wouldn’t add another step for the end-users.

PS: If you post something like this please include the code as text within the </> formatting and share which error you’re getting.