Data Types
The data type refers to the way a value is represented by the image pixels. The data type describes the mathematical format of the pixel, such as integer, floating point or real, along with the size or precision of the format. For example, one accepted data type is the 16 bit unsigned integer which accommodates pixel values in the range 0 through 65535. This is data type code 3 or name "ushort".
Different methods in the script language work with data type as a number or string. For example, in the CImage class, Datatype returns the image data type as a coded number, whereas DatatypeStr returns the data type as a string. The table below shows the relationship between these different ways of expressing the data type. The "Bytes" column gives the number of bytes per pixel when the image is loaded into memory.
Code |
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. |
|