CImage:PixGE CImage:ValStr

CImage:Val


The Val method returns the pixel value at coordinate (x,y). The value is returned as a number, even for a color image. The ValStr method returns the value as a string, which can accommodate color values.

Syntax

nVal = CImage:Val( x, y )

    wherenVal is a number.

    x and y are the column and row pixel coordinates, respectively, and may be passed as numbers or strings.

Example

The following script fragment shows an image at path sPath being opened and the pixel value at column 53, row 400 being printed to a standard text window:

 

I = CImage:new()

-- Create a CImage

I:Open( sPath )

-- Open the image from file path sPath.

n = I:Val(53,400)

-- Return the pixel value at x,y

Printf("value=%lg\n",n)

-- print the pixel value

Related Topics

CImage, ValStr, SetVal