Overlay and Animations

For scripts to aid with computation or simulation in cellular automata.
Post Reply
egg4
Posts: 1
Joined: July 3rd, 2017, 4:26 pm

Overlay and Animations

Post by egg4 » July 11th, 2017, 10:21 pm

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

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Overlay and Animations

Post by dvgrn » July 12th, 2017, 7:49 am

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.

User avatar
rowett
Moderator
Posts: 3777
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: Overlay and Animations

Post by rowett » July 12th, 2017, 2:43 pm

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!

Post Reply