CImage:KwdGetVal


The KwdGetVal method returns the value of a keyword from the image header. This method works with a keyword of any type, including string, number, date, time, etc. The value returned is a string.

Syntax

sValue = CImage:KwdGetVal( sKwd )

where

    sKwd is the keyword name.

    sValue is the returned value of sKwd. On failure, nil is returned.

  

This method returns the value of a keyword of any type. No test is performed to determine if the keyword actually exists but nil is returned for general failure, which could also indicate that the keyword is invalid or improperly formatted. To test whether the keyword exists, call KwdExists before this method. Alternatively, KwdGetValEx returns 2 parameters: a boolean status code and the keyword value.

Example

Suppose a CImage named I exists and contains keywords "FILTER", a string valued keyword, and GAIN, a number valued keyword. The following script returns the value of both keywords from for the image I:

 

f = I:KwdGetVal("FILTER")

-- read the keyword value

Printf( "Filter= '%s'",f)

-- prints Filter= 'Red'

f = I:KwdGetVal( "GAIN" )

-- read the keyword value

Printf( "Gain= '%s'", f )

-- printf Gain= '1.52'

Related Topics

KwdGetValEx

KwdGetNum

KwdGetStr

CImage class