You cannot pre-render UI from Activity Script. What you can do is to render the UI prior to showing the page by using the Page Script.
Note that whenever you change activities, all Script data is discarded. To save/restore across Activities, you can use 'Globals' which I discuss below.
There is a thread here where I discuss what is the difference between GUI.widget and CF.widget. The Activity and Page widget() functions are the equivalent of CF.widget. Note that GUI.widget is best used as a render target whereas the other functions CF, Activity, Page are best used to retrieve images from resources from your config. Also note that GUI.widget allows you to retrieve items with tags that may be on the System Page that are merged into view when your actual page is shown.
On order to use such functionality to capture your images as strings, you will need to have a look inside the Philips HTTP Library and intercept the string used to create the images prior to storing them into the widget. Possibly by modifying the Philips script. You Won't need to use Base64 encoding to save the image data. Beware that there is a limit to the amount of data you can save with System Globals. I seem to recall that it is something like 64KB per named Global.