CImage:ColToTable


The ColToTable method copies the pixels of a CImage column into a 1-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 inverse operation, pasting a column into a CImage, is done using the TableToCol method.

Syntax

lua_table = CImage:ColToTable(nCol)

lua_table = CImage:ColToTable(nCol, nRowMax)

lua_table = CImage:ColToTable(nCol, nRowMin, nRowMax)

bullet.gif    nCol is the column number

bullet.gif    nRowMin is the minimum row to extract.

bullet.gif    nRowMax is the maximum row to extract.

bullet.gif    lua_table is a 1--dimensional array.

bullet.gif    On failure, nil is returned.

Examples

The following script creates a 1-dimensional table consisting of image column 40. The number of table elements equals the number of rows in the image:

I = new_image()

-- create a CImage object

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

 

tbl = I:ColToTable(40)

-- create a lua_table from column 40

  

The next script creates a 1-dimensional table consisting of image column 40 over rows 200 to 300. The table will have 101 elements:

I = new_image()

-- create a CImage object

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

 

tbl = I:ColToTable(40, 200, 300)

-- create a lua_table from the image pixels.

 

Related Topics

CImage class, RowToTable, RectToTable, ToTable, arraytoimage, TableToCol, Table and Array Functions


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