---
name: "cl_image_format"
section: "3clc"
platform: "linux"
package: "opencl-1.2-man-doc"
version: "1.0~svn33624-5.1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cl_image_format"
---

# cl\_image\_format(3clc)

The image format descriptor structure is defined as:

## NAME

cl\_image\_format - The image format descriptor structure is defined as:

###

| |
| --- |
| typedef struct \_cl\_image\_format { cl\_channel\_order image\_channel\_order; cl\_channel\_type image\_channel\_data\_type; } cl\_image\_format; |

## MEMBERS

image\_channel\_order

Specifies the number of channels and the channel layout i.e. the memory layout in which channels are stored in the image. Valid values are described in the table below.

| | |
| --- | --- |
| **Format** | **Description** |
| CL\_R, CL\_Rx, or CL\_A |  |
| CL\_INTENSITY | This format can only be used if channel data type = CL\_UNORM\_INT8, CL\_UNORM\_INT16, CL\_SNORM\_INT8, CL\_SNORM\_INT16, CL\_HALF\_FLOAT, or CL\_FLOAT. |
| CL\_LUMINANCE | This format can only be used if channel data type = CL\_UNORM\_INT8, CL\_UNORM\_INT16, CL\_SNORM\_INT8, CL\_SNORM\_INT16, CL\_HALF\_FLOAT, or CL\_FLOAT. |
| CL\_RG, CL\_RGx, or CL\_RA |  |
| CL\_RGB or CL\_RGBx | This format can only be used if channel data type = CL\_UNORM\_SHORT\_565, CL\_UNORM\_SHORT\_555 or CL\_UNORM\_INT101010. |
| CL\_RGBA |  |
| CL\_ARGB, CL\_BGRA. | This format can only be used if channel data type = CL\_UNORM\_INT8, CL\_SNORM\_INT8, CL\_SIGNED\_INT8 or CL\_UNSIGNED\_INT8. |

image\_channel\_data\_type

Describes the size of the channel data type. The number of bits per element determined by the **image\_channel\_data\_type** and **image\_channel\_order** must be a power of two. The list of supported values is described in the table below.

| | |
| --- | --- |
| **Image Channel Data Type** | **Description** |
| CL\_SNORM\_INT8 | Each channel component is a normalized signed 8-bit integer value. |
| CL\_SNORM\_INT16 | Each channel component is a normalized signed 16-bit integer value. |
| CL\_UNORM\_INT8 | Each channel component is a normalized unsigned 8-bit integer value. |
| CL\_UNORM\_INT16 | Each channel component is a normalized unsigned 16-bit integer value. |
| CL\_UNORM\_SHORT\_565 | Represents a normalized 5-6-5 3-channel RGB image. The channel order must be CL\_RGB or CL\_RGBx. |
| CL\_UNORM\_SHORT\_555 | Represents a normalized x-5-5-5 4-channel xRGB image. The channel order must be CL\_RGB or CL\_RGBx. |
| CL\_UNORM\_INT\_101010 | Represents a normalized x-10-10-10 4-channel xRGB image. The channel order must be CL\_RGB or CL\_RGBx. |
| CL\_SIGNED\_INT8 | Each channel component is an unnormalized signed 8-bit integer value. |
| CL\_SIGNED\_INT16 | Each channel component is an unnormalized signed 16-bit integer value. |
| CL\_SIGNED\_INT32 | Each channel component is an unnormalized signed 32-bit integer value. |
| CL\_UNSIGNED\_INT8 | Each channel component is an unnormalized unsigned 8-bit integer value. |
| CL\_UNSIGNED\_INT16 | Each channel component is an unnormalized unsigned 16-bit integer value. |
| CL\_UNSIGNED\_INT32 | Each channel component is an unnormalized unsigned 32-bit integer value. |
| CL\_HALF\_FLOAT | Each channel component is a 16-bit half-float value. |
| CL\_FLOAT | Each channel component is a single precision floating-point value. |

## DESCRIPTION

For example, to specify a normalized unsigned 8-bit / channel RGBA image:

```
image_channel_order = CL_RGBA
image_channel_data_type = CL_UNORM_INT8
```

*image\_channel\_data\_type* values of **CL\_UNORM\_SHORT\_565**, **CL\_UNORM\_SHORT\_555** and **CL\_UNORM\_INT\_101010** are special cases of packed image formats where the channels of each element are packed into a single unsigned short or unsigned int. For these special packed image formats, the channels are normally packed with the first channel in the most significant bits of the bitfield, and successive channels occupying progressively less significant locations. For **CL\_UNORM\_SHORT\_565**, R is in bits 15:11, G is in bits 10:5 and B is in bits 4:0. For **CL\_UNORM\_SHORT\_555**, bit 15 is undefined, R is in bits 14:10, G in bits 9:5 and B in bits 4:0. For **CL\_UNORM\_INT\_101010**, bits 31:30 are undefined, R is in bits 29:20, G in bits 19:10 and B in bits 9:0.

OpenCL implementations must maintain the minimum precision specified by the number of bits in image\_channel\_data\_type. If the image format specified by image\_channel\_order, and image\_channel\_data\_type cannot be supported by the OpenCL implementation, then the call to [**clCreateImage**(3clc)](/clCreateImage/3clc.md) will return a NULL memory object.

## SPECIFICATION

**OpenCL Specification**\[1\]

## SEE ALSO

[**imageDescriptor**(3clc)](/imageDescriptor/3clc.md), [**EXTENSION**(3clc)](/EXTENSION/3clc.md), [**clGetSupportedImageFormats**(3clc)](/clGetSupportedImageFormats/3clc.md), [**clCreateImage**(3clc)](/clCreateImage/3clc.md)

## AUTHORS

**The Khronos Group**

## COPYRIGHT

Copyright © 2007-2010 The Khronos Group Inc.\
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and/or associated documentation files (the "Materials"), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Materials, and to permit persons to whom the Materials are furnished to do so, subject to the condition that this copyright notice and permission notice shall be included in all copies or substantial portions of the Materials.

## NOTES

- 1\.

  OpenCL Specification

  page 92, section 5.3.1.1 - Image Format Descriptor
