CImage:ToTable
The ToTable method copies the pixels of the entire CImage to a 2-dimensional array. If the CImage has a numeric pixel type (e.g., "ushort", "float", etc.) then the array has numeric values. If the CImage has an rgb pixel type, then the array has rgb strings as values, for example "255,0,0" for pure red. See Pixel Types. The dimensionality of the array is determined by the dimensions of the CImage. To extract a smaller array from a rectangular region of the CImage, use RectToTable, ColToTable, or RowToTable. The inverse operation, copying an array to a new CImage, is done using the non-class arraytoimage function.
tbe = CImage:ToTable()
where tbl is a 2-dimensional array.
On failure, nil is returned.
The following script copies the image into a 2-dimensional array.
|
-- create a CImage object |
-- fill the image or open it from a file... |
|
|
-- create a table from the image pixels. |
CImage class, RectToTable, TableToRect, arraytoimage, Table and Array Functions
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.