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.

Syntax

tbe = CImage:ToTable()

bullet.gif    where tbl is a 2-dimensional array.

bullet.gif    On failure, nil is returned.

Examples

The following script copies the image into a 2-dimensional array.

I = new_image()

-- create a CImage object

-- fill the image or open it from a file...

 

tbl = I:ToTable()

-- create a table from the image pixels.

  

Related Topics

CImage class, RectToTable, TableToRect, arraytoimage, Table and Array Functions


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.