CImage:SetDatatype


The SetDatatype method sets or changes the pixel data type of image pixels. To retrieve the data type of the image, use the Datatype method.

Syntax

CImage:SetDatatype( datatype )

where

    datatype is a string giving the data type.

  

The datatype argument a string representing the target data type as defined in the Mira Data Types table. You also can specify one of the numeric codes listed in the data type table, but this is not advised as it makes the script less readable. For example, the code 1 corresponds to data type string "byte".

Example

The following script loads an image, changes its data type to "float" (32 bit real), and then saves the image:

I = CImage:new()

-- Create a CImage

I:Open( sPath )

-- Open the image from file path sPath.

I:SetDatatype( "float" )

-- change data type to 32 bit real

I:Save()

-- save the image

Related Topics

Datatype,

CImage class

Mira Data Types