Image Embed

Script to read an image file onto a widget

This script illustrates how to read images onto widgets. In PRIMER there are two options for doing this:

1) Read an image from disk. This is convenient to code but requires the image to always be available, which may not be possible.
2) Embed the image into the script using a string. Converting an image to a string representation is more robust as everything is stored within the script itself.

GetImageString(): This function takes an image and returns a string containing the image data.

This example uses two buttons to illustrate both methods. The first button has an image read from file, and the second button’s image is embedded using a string. The example also shows how to (optional) output the image string to a text file.