Image Read and Write Functions

Click an item in the table below for details about that function.

read_imagef for 1D and 2D Do an element lookup in the 1D or 2D image object, returning floating-point values
read_image{i|ui} for 1D and 2D Do an element lookup in the 1D or 2D image object, returning unnormalized signed integer and unsigned integer values
read_imageh for 1D and 2D OPTIONAL function to do an element lookup in the 1D or 2D image object, returning floating-point values. Enabled with cl_khr_fp16.
write_image {f|i|ui} for 1D and 2D Write color value to location in the 1D or 2D image object
write_imageh for 1D and 2D OPTIONAL function to write color value in a 1D or 3D object. Enabled with cl_khr_fp16.
read_imagef for 3D Do an element lookup in the 3D image object, returning floating-point values
read_imagei for 3D Do an element lookup in the 3D image object, returning unnormalized signed integer and unsigned integer values
read_imageh for 3D Do an element lookup in the 3D image object, returning half floating point values. Enabled with cl_khr_fp16.
write_imageh for 3D OPTIONAL function to write color value in a 3D object. Enabled with cl_khr_fp16.
write_image{f i ui} for 3D OPTIONAL function to write color value in a 3D object. Enabled with cl_khr_3d_image_writes.
get_image_width Return the 2D or 3D image width in pixels
get_image_height Return the 2D or 3D image height in pixels.
get_image_depth Return the 3D image depth in pixels
get_image_channel_data_type Return the image channel data type
get_image_channel_order Return the image channel order
get_image_dim Return the image dimensions

Description

The built-in image function calls to read and write images are supported..

The generic type gentype is used to indicate the built-in data types char, uchar, short, ushort, int, uint, long, ulong, or float.

The generic type name gentypen is used to indicate the built-in data types char{2|4|8|16}, uchar{2|4|8|16}, short{2|4|8|16}, ushort{2|4|8|16}, int{2|4|8|16}, uint{2|4|8|16}, long{2|4|8|16}, ulong{2|4|8|16}, or float{2|4|8|16} as the type for the arguments unless otherwise stated.

The suffix used in gentypen or the function name (i.e. vloadn, vstoren, etc.) represents the number of elements in the built-in vector type (n = 2, 4, 8, or 16).

The image read and write functions are extended with cl_khr_fp16 to include appropriate versions of functions that take half4 as arguments and return values.

Specification

OpenCL Specification

Also see

sampler_t, cl_khr_3d_image_writes

Copyright © 2007-2009 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.