CImage:GetVal


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

Syntax

nVal = CImage:GetVal( x, y )

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

bullet.gif    nVal is a number.

Example

The following script shows an image at path sPath being opened and the pixel value at column 53, row 400 being written to the default Text Editor window:

I = new_image()

-- Create a CImage

I:Open( sPath )

-- Open the image from file path sPath.

n = I:GetVal(53,400)

-- Return the pixel value at x,y

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

-- print the pixel value

Related Topics

CImage class, GetValStr, SetVal


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