CImage:Datatype
The Datatype method returns the data type of image pixels as a numeric code. The data type refers to the value representation stored in the pixel (integer, real, etc.).
nCode = CImage:Datatype() |
where the number nCode is the Mira data type code (see Remarks).
The data type returned by this method is defined in the Mira Data Types table. You can also use the DatatypeStr method to retrieve the data type name as a string.
Suppose the file sPath contains an image with "long" (32 bit integer) pixels. The following script fragment prints the data type of the image:
I = CImage:new() |
-- Create a CImage |
I:Open( sPath ) |
-- Open the image from file path sPath. |
d = I:Datatype() |
-- retrieve the numeric data type |
Printf( "Data type = %d\n",d) |
-- result: Data type = 4 |
I:delete() |
-- delete the CImage from memory |