Starting from version 1.9.0, images in Xcas are special objects which can be loaded from PNG, JPEG or GIF files and written to PNG files. Such objects allow for visualization, extraction and modification of the image data. An image object evaluates to a string describing the structure of the image.
In earlier versions of Xcas, an image is a list with the following elements (referred to as the legacy format in the further text):
The color of the point at line i and column j is determined by the values of the (i,j)th entry of the matrices. Note that the transparency channel data comes before the blue channel data since color values in Xcas are red=1, green=2 and blue=4, which allows for extraction of channel data using colors as indices.
Note that the number of points in the structure is not necessarily the same as the number of pixels on the screen when it is drawn. A single point in the structure can appear as a (small) rectangle of pixels when displayed on the screen.
Loading images to the legacy format is supported by the readrgb command.