Pixel Types


The pixel type describes the format of the value stored in a number or string. This may be a numeric value such as an integer or floating point number, or a string value for more complex quantities such as RGB color data. All Mira pixel types are listed in the table below.

Different functions and methods use the pixel type as a numeric code or string name as shown in the table below. For example, in the CImage class, CImage:PixelType returns the pixel type as an integer code and CImage:PixelTypeStr returns the pixel type as a string. Among global functions, PixelTypeToStr converts the pixel type number to its string name, and StrToPixelType converts the pixel type string to its numeric code.

The CFile:Read and Write methods use the string name to specify the pixel type of the value to read or write when working with a binary file. In the table below, the Bytes column gives the number of memory bytes per pixel.

Pixel Types

Code

String Name

Bytes

Mathematical Description

1

byte

1

8 bit unsigned integer with range 0 to 255.

2

short

2

16 bit signed integer with range -32768 to 32767.

3

ushort

2

16 bit unsigned integer with range 0 to 65535.

4

long

4

32 bit signed integer.

5

float

4

32 bit IEEE floating point.

6

double

8

64 bit IEEE floating point.

7

rgb

4

24 bit color with each color channel containing a byte value in the range 0 to 255. Each pixel has 32 bits (4 bytes) consisting of 3, 8-bit channels plus one unused 8-bit channel.

8

urgb

8

48 bit color with each color channel containing a 16 bit unsigned integer value in the range 0 to 65535. Each pixel has 64 bits (8 bytes) consisting of 3, 16-bit channels plus one unused 16-bit channel.

9

lrgb

16

96 bit color with each color channel containing a 32 bit integer value. Each pixel has 128 bits (16 bytes) consisting of 3, 32-bit channels plus one unused 32-bit channel.

10

frgb

16

96 bit real color with each color channel containing a 32 bit floating point value. Each pixel has 128 bits (16 bytes) consisting of 3, 32-bit channels plus one unused 32-bit channel.

11

drgb

32

192 bit real color with each color channel containing a 64 bit floating point ("double") value. Each pixel has 256 bits (32 bytes) consisting of 3, 64-bit channels plus one unused 64-bit channel.

12

str

length+1

A string value consisting of one or more 8-bit characters. The number of bytes equals the string length plus 1 character for the terminating null.

Related Topics

CImage:PixelType, CImage:SetPixelType, PixelTypeToStr, StrToPixelType, CFile:Read, CFile:Write


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