CImage:PixelType (replaces Datatype)


The PixelType method returns the pixel type of image pixels as a numeric code. The pixel type refers to the value representation stored in the pixel (integer, real, etc.).

Syntax

nCode = CImage:PixelType()

bullet.gif    where the number nCode is the Mira pixel type code (see Remarks).

Remarks

The pixel type returned by this method is defined in the Pixel Types table. You can also use the PixelTypeStr method to retrieve the pixel type name as a string.

Example

Suppose the file sPath contains an image with "long" (32 bit integer) pixels. The following script prints the pixel type of the image:

I = new_image()

-- Create a CImage

I:Open( sPath )

-- Open the image from file path sPath.

d = I:PixelType()

-- retrieve the numeric pixel type

Printf( "Pixel Type = %d\n",d)

-- result: Pixel Type = 4

I:delete()

-- delete the CImage from memory

Related Topics

CImage class, PixelTypeStr, SetPixelType, Pixel Types


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