Page 1 of 1

Overlay and Animations

Posted: July 11th, 2017, 10:21 pm
by egg4
Hello!

I have two questions, I am new to both scripting and Golly so bear with me...

I am currently running Golly 3.0b1 on Windows 10 with Python 2.7 (all 64 bit) (if any of this is relevant)

I have been looking for a way to extract high-quality images from Golly so that I can put them together into an animation (i know there is LifeViewer for this, however I do not think the 'style' of the LifeViewer animations is exactly what I want, I want something that literally looks like Golly I suppose). Anyway, I downloaded the beta version of Golly 3.0 and I like the image that the Save Overlay function outputs, however, I was able to use this when selecting "save overlay" from the layer menu, and now for some reason when I go there "save overlay" is gray and will not let me select it?? does anyone know why this might be?? (as I've said before, I'm a total n00b lol)

Secondly, I am wondering if it is possible to write a script that automates the Save Overlay function so that it saves a PNG image upon each generation (so that I can us all of these images as frames of an animation). I'm not necessarily asking someone to write a script for me, I was just wondering if I could do it/how I could go about doing it (also if such a script is already in existence, I would not mind being directed to it).

thanks guys! :D

Re: Overlay and Animations

Posted: July 12th, 2017, 7:49 am
by dvgrn
egg4 wrote:I downloaded the beta version of Golly 3.0 and I like the image that the Save Overlay function outputs, however, I was able to use this when selecting "save overlay" from the layer menu, and now for some reason when I go there "save overlay" is gray and will not let me select it?? does anyone know why this might be??
The only thing I can think of is that you have to have an overlay before you can save it. Try running overlay-demo.lua, choosing Animation, and then Layer > Save Overlay.
egg4 wrote:Secondly, I am wondering if it is possible to write a script that automates the Save Overlay function so that it saves a PNG image upon each generation (so that I can use all of these images as frames of an animation).
Here's a link to the last time that question came up. Maybe try altering the script there to do what you want. If you run into any trouble, post your revised version here and we can probably figure something out.

Re: Overlay and Animations

Posted: July 12th, 2017, 2:43 pm
by rowett
The Overlay is a rectangle of pixels that is drawn on top of the pattern. The Save Overlay menu option saves just the Overlay. So if you don't have an Overlay the menu option will be grayed out.

Fortunately the Overlay has a CellView capability that is used to draw patterns onto the Overlay.

It would be a good exercise to write a Lua script that initially created an Overlay ov("create "..wd.." "..ht"), created a Cell View ov("cellview -512 -512 1024 1024"), prompt the user for the number of generations and a folder to save the images in.

It should then in a loop:
  1. step to the next generation g.run(1) g.update()
  2. update the Cell View from the pattern ov("updatecells")
  3. draw the cells onto the Overlay ov("drawcells")
  4. draw the Overlay ov("update")
  5. save the Overlay into a PNG file ov("save 0 0 0 0 "..savefolder.."image"..number..".png")
See Help->Overlay and Help->Lua Scripting in Golly for more information. Also worth checking out some of the sample Lua scripts in Scripts/Lua/:
  • overlay-demo.lua to see how to use a Cell View
  • browse-patterns.lua to see how to prompt for a folder
  • pop-plot.lua to see how to prompt for a number of generations
Good luck!