Get information specific to an image object.

cl_int clGetImageInfo ( cl_mem image,
  cl_image_info param_name,
  size_t param_value_size,
  void *param_value,
  size_t *param_value_size_ret)



Specifies the image object being queried.


Specifies the information to query. The list of supported param_name types and the information returned in param_value by clGetImageInfo is described in the table below.


A pointer to memory where the appropriate result being queried is returned. If param_value is NULL, it is ignored.


Used to specify the size in bytes of memory pointed to by param_value. This size must be greater than or equal to size of return type as described in the table below.

cl_image_info Return Type Info. returned in param_value
CL_IMAGE_FORMAT cl_image_format Return image format descriptor specified when image is created with clCreateImage2D or clCreateImage3D.
CL_IMAGE_ELEMENT_SIZE size_t Return size of each element of the image memory object given by image. An element is made up of n channels. The value of n is given in cl_image_format descriptor.
CL_IMAGE_ROW_PITCH size_t Return size in bytes of a row of elements of the image object given by image.
CL_IMAGE_SLICE_PITCH size_t Return size in bytes of a 2D slice for the 3D image object given by image. For a 2D image object this value will be 0.
CL_IMAGE_WIDTH size_t Return width of image in pixels.
CL_IMAGE_HEIGHT size_t Return height of image in pixels.
CL_IMAGE_DEPTH size_t Return depth of the image in pixels. For a 2D image, depth equals 0.
CL_IMAGE_D3D10_SUBRESOURCE_KHR ID3D10Resource * The propery being queried (if the cl_khr_d3d10_sharing extension is enabled). If image was created using clCreateFromD3D10Texture2DKHR or clCreateFromD3D10Texture3DKHR, returns the subresource argument specified when image was created.

the actual size in bytes of data being queried by param_value. If param_value_size_ret is NULL, it is ignored.


To get information that is common to all memory objects (buffer and image objects), use the clGetMemObjectInfo function.


Returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:

  • CL_INVALID_MEM_OBJECT if image is a not a valid image object.
  • CL_INVALID_VALUE if param_name is not valid, or if size in bytes specified by param_value_size is less than the size of return type as described in the table above and param_value is not NULL.
  • CL_INVALID_D3D10_RESOURCE_KHR if param_name is CL_MEM_D3D10_SUBRESOURCE_KHR and image was not created by the function clCreateFromD3D10Texture2DKHR or clCreateFromD3D10Texture3DKHR.
  • CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device.
  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.


OpenCL Specification

Also see


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.