Previous Up

15.3.4  Creating or recreating images: writergb

The writergb command writes images to png files; the image can be given by the Xcas image structure (see Section 15.3.1, this is what is read in with readrgb) or a simplified version of this structure.

To write an image given by the Xcas image structure to a file:


Examples.


The simplified version of the Xcas image description doesn’t involve stating the number of channels, the size of the image, or the transparency. There is a full color version of this simplified form and a grayscale version.

To create a full color image using the simple description:


Example.
Input:

writergb("image2.png",[[255,250],[0,120]],[[0,255],[0,0]],[[0,0],[255,100]])

Output:

This image will be in the file image2.png.


To create a grayscale image using the simple description:


Example.
Input:

writergb("image3.png",[[65,125],[185,200]])

Output:

This image will be in the file image3.png.


Previous Up