1# Image
2
3
4## Overview
5
6The **Image** module enables access to image APIs.
7
8**System capability**: SystemCapability.Multimedia.Image
9
10**Since**: 8
11
12
13## Summary
14
15
16### Files
17
18| Name| Description| 
19| -------- | -------- |
20| [image_mdk.h](image__mdk_8h.md) | Declares the APIs used to access the image rectangle, size, format, and component data.| 
21| [image_mdk_common.h](image__mdk__common_8h.md) | Declares the common enums and structs used by the image APIs.|
22| [image_packer_mdk.h](image__packer__mdk_8h.md) | Declares the APIs used to pack an image into a buffer or file.| 
23| [image_pixel_map_mdk.h](image__pixel__map__mdk_8h.md) | Declares the APIs used to lock, access, and unlock a pixel map.| 
24| [image_pixel_map_napi.h](image__pixel__map__napi_8h.md) | (Deprecated) Declares the APIs used to lock, access, and unlock a pixel map.| 
25| [image_receiver_mdk.h](image__receiver__mdk_8h.md) | Declares the APIs used to obtain image data from the native layer.| 
26| [image_source_mdk.h](image__source__mdk_8h.md) | Declares the APIs used to decode an image source into a pixel map.|
27
28
29### Structs
30
31| Name| Description| 
32| -------- | -------- |
33| struct  [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) | Defines the information about an image rectangle. | 
34| struct  [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) | Defines the information about an image component. | 
35| struct  [OhosImageSize](_ohos_image_size.md) | Defines the image size. | 
36| struct  [ImagePacker_Opts_](_image_packer___opts__.md) | Defines the image packing options. | 
37| struct  [OhosPixelMapInfos](_ohos_pixel_map_infos.md) | Defines the information about a pixel map. | 
38| struct  [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) | Defines the options for creating a pixel map. | 
39| struct  [OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md) | Defines the information about a pixel map. | 
40| struct  [OhosImageReceiverInfo](_ohos_image_receiver_info.md) | Defines the information about an image receiver. | 
41| struct  [OhosImageRegion](_ohos_image_region.md) | Defines the region of an image source to decode. | 
42| struct  [OhosImageSourceOps](_ohos_image_source_ops.md) | Defines the image source options. | 
43| struct  [OhosImageDecodingOps](_ohos_image_decoding_ops.md) | Defines the options for decoding an image source. | 
44| struct  [OhosImageSourceInfo](_ohos_image_source_info.md) | Defines the information about an image source. | 
45| struct  [OhosImageSource](_ohos_image_source.md) | Defines the input resource of an image source. Only one type of resource is accepted at a time. | 
46| struct  [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md) | Defines the delay time list of an image source. | 
47| struct  [OhosImageSourceSupportedFormat](_ohos_image_source_supported_format.md) | Defines the format string supported by an image source.  | 
48| struct  [OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md) | Defines the format string list supported by an image source.  | 
49| struct  [OhosImageSourceProperty](_ohos_image_source_property.md) | Defines the property string (in key-value format) of an image source.  | 
50| struct  [OhosImageSourceUpdateData](_ohos_image_source_update_data.md) | Defines the update data of an image source. | 
51
52
53### Macros
54
55| Name| Description| 
56| -------- | -------- |
57| **IMAGE_RESULT_BASE** 62980096 | Defines the basic value returned by the interface. |
58
59
60### Types
61
62| Name| Description| 
63| -------- | -------- |
64| typedef struct ImageNative_ [ImageNative](#imagenative) | Defines an image object at the native layer. | 
65| typedef struct ImagePacker_Native_ [ImagePacker_Native](#imagepacker_native) | Defines an image packer object at the native layer. | 
66| typedef struct [ImagePacker_Opts_](_image_packer___opts__.md) [ImagePacker_Opts](#imagepacker_opts) | Defines the alias of the image packing options. | 
67| typedef struct NativePixelMap_ [NativePixelMap](#nativepixelmap) | Defines the data type name of the pixel map at the native layer. | 
68| typedef struct [OhosPixelMapInfos](_ohos_pixel_map_infos.md) [OhosPixelMapInfos](#ohospixelmapinfos) | Defines the information about a pixel map. | 
69| typedef struct ImageReceiverNative_ [ImageReceiverNative](#imagereceivernative) | Defines the data type name of the image receiver at the native layer. | 
70| typedef void(\* [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback)) () | Defines the callbacks for the image interface at the native layer. | 
71| typedef struct ImageSourceNative_ [ImageSourceNative](#imagesourcenative) | Defines an image source object at the native layer. | 
72
73
74### Enums
75
76| Name| Description| 
77| -------- | -------- |
78| { OHOS_IMAGE_FORMAT_YCBCR_422_SP = 1000,<br>OHOS_IMAGE_FORMAT_JPEG = 2000 } | Enumerates the image formats.| 
79| { OHOS_IMAGE_COMPONENT_FORMAT_YUV_Y = 1,<br>OHOS_IMAGE_COMPONENT_FORMAT_YUV_U = 2,<br>OHOS_IMAGE_COMPONENT_FORMAT_YUV_V = 3,<br>OHOS_IMAGE_COMPONENT_FORMAT_JPEG = 4 } | Enumerates the image components.| 
80| [IRNdkErrCode](#irndkerrcode-1) {<br>IMAGE_RESULT_SUCCESS = 0, IMAGE_RESULT_BAD_PARAMETER = -1,<br>IMAGE_RESULT_IMAGE_RESULT_BASE = IMAGE_RESULT_BASE,<br>IMAGE_RESULT_ERR_IPC = IMAGE_RESULT_BASE + 1,<br>IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST = IMAGE_RESULT_BASE + 2,<br>IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL = IMAGE_RESULT_BASE + 3,<br>IMAGE_RESULT_DECODE_ABNORMAL = IMAGE_RESULT_BASE + 4,<br>IMAGE_RESULT_DATA_ABNORMAL = IMAGE_RESULT_BASE + 5,<br>IMAGE_RESULT_MALLOC_ABNORMAL = IMAGE_RESULT_BASE + 6,<br>IMAGE_RESULT_DATA_UNSUPPORT = IMAGE_RESULT_BASE + 7,<br>IMAGE_RESULT_INIT_ABNORMAL = IMAGE_RESULT_BASE + 8,<br>IMAGE_RESULT_GET_DATA_ABNORMAL = IMAGE_RESULT_BASE + 9,<br>IMAGE_RESULT_TOO_LARGE = IMAGE_RESULT_BASE + 10,<br>IMAGE_RESULT_TRANSFORM = IMAGE_RESULT_BASE + 11,<br>IMAGE_RESULT_COLOR_CONVERT = IMAGE_RESULT_BASE + 12,<br>IMAGE_RESULT_CROP = IMAGE_RESULT_BASE + 13,<br>IMAGE_RESULT_SOURCE_DATA = IMAGE_RESULT_BASE + 14,<br>IMAGE_RESULT_SOURCE_DATA_INCOMPLETE = IMAGE_RESULT_BASE + 15,<br>IMAGE_RESULT_MISMATCHED_FORMAT = IMAGE_RESULT_BASE + 16,<br>IMAGE_RESULT_UNKNOWN_FORMAT = IMAGE_RESULT_BASE + 17,<br>IMAGE_RESULT_SOURCE_UNRESOLVED = IMAGE_RESULT_BASE + 18,<br>IMAGE_RESULT_INVALID_PARAMETER = IMAGE_RESULT_BASE + 19,<br>IMAGE_RESULT_DECODE_FAILED = IMAGE_RESULT_BASE + 20,<br>IMAGE_RESULT_PLUGIN_REGISTER_FAILED = IMAGE_RESULT_BASE + 21,<br>IMAGE_RESULT_PLUGIN_CREATE_FAILED = IMAGE_RESULT_BASE + 22,<br>IMAGE_RESULT_ENCODE_FAILED = IMAGE_RESULT_BASE + 23,<br>IMAGE_RESULT_ADD_PIXEL_MAP_FAILED = IMAGE_RESULT_BASE + 24,<br>IMAGE_RESULT_HW_DECODE_UNSUPPORT = IMAGE_RESULT_BASE + 25,<br>IMAGE_RESULT_DECODE_HEAD_ABNORMAL = IMAGE_RESULT_BASE + 26,<br>IMAGE_RESULT_DECODE_EXIF_UNSUPPORT = IMAGE_RESULT_BASE + 27,<br>IMAGE_RESULT_PROPERTY_NOT_EXIST = IMAGE_RESULT_BASE + 28,<br>IMAGE_RESULT_MEDIA_DATA_UNSUPPORT = IMAGE_RESULT_BASE + 30,<br>IMAGE_RESULT_MEDIA_TOO_LARGE = IMAGE_RESULT_BASE + 31,<br>IMAGE_RESULT_MEDIA_MALLOC_FAILED = IMAGE_RESULT_BASE + 32,<br>IMAGE_RESULT_MEDIA_END_OF_STREAM = IMAGE_RESULT_BASE + 33,<br>IMAGE_RESULT_MEDIA_IO_ABNORMAL = IMAGE_RESULT_BASE + 34,<br>IMAGE_RESULT_MEDIA_MALFORMED = IMAGE_RESULT_BASE + 35,<br>IMAGE_RESULT_MEDIA_BUFFER_TOO_SMALL = IMAGE_RESULT_BASE + 36,<br>IMAGE_RESULT_MEDIA_OUT_OF_RANGE = IMAGE_RESULT_BASE + 37,<br>IMAGE_RESULT_MEDIA_STATUS_ABNORMAL = IMAGE_RESULT_BASE + 38,<br>IMAGE_RESULT_MEDIA_VALUE_INVALID = IMAGE_RESULT_BASE + 39,<br>IMAGE_RESULT_MEDIA_NULL_POINTER = IMAGE_RESULT_BASE + 40,<br>IMAGE_RESULT_MEDIA_INVALID_OPERATION = IMAGE_RESULT_BASE + 41,<br>IMAGE_RESULT_MEDIA_ERR_PLAYER_NOT_INIT = IMAGE_RESULT_BASE + 42,<br>IMAGE_RESULT_MEDIA_EARLY_PREPARE = IMAGE_RESULT_BASE + 43,<br>IMAGE_RESULT_MEDIA_SEEK_ERR = IMAGE_RESULT_BASE + 44,<br>IMAGE_RESULT_MEDIA_PERMISSION_DENIED = IMAGE_RESULT_BASE + 45,<br>IMAGE_RESULT_MEDIA_DEAD_OBJECT = IMAGE_RESULT_BASE + 46,<br>IMAGE_RESULT_MEDIA_TIMED_OUT = IMAGE_RESULT_BASE + 47,<br>IMAGE_RESULT_MEDIA_TRACK_NOT_ALL_SUPPORTED = IMAGE_RESULT_BASE + 48,<br>IMAGE_RESULT_MEDIA_ADAPTER_INIT_FAILED = IMAGE_RESULT_BASE + 49,<br>IMAGE_RESULT_MEDIA_WRITE_PARCEL_FAIL = IMAGE_RESULT_BASE + 50,<br>IMAGE_RESULT_MEDIA_READ_PARCEL_FAIL = IMAGE_RESULT_BASE + 51,<br>IMAGE_RESULT_MEDIA_NO_AVAIL_BUFFER = IMAGE_RESULT_BASE + 52,<br>IMAGE_RESULT_MEDIA_INVALID_PARAM = IMAGE_RESULT_BASE + 53,<br>IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_EXIST = IMAGE_RESULT_BASE + 54,<br>IMAGE_RESULT_MEDIA_CREATE_CODEC_ADAPTER_FAILED = IMAGE_RESULT_BASE + 55,<br>IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_INIT = IMAGE_RESULT_BASE + 56,<br>IMAGE_RESULT_MEDIA_ZCODEC_CREATE_FAILED = IMAGE_RESULT_BASE + 57,<br>IMAGE_RESULT_MEDIA_ZCODEC_NOT_EXIST = IMAGE_RESULT_BASE + 58,<br>IMAGE_RESULT_MEDIA_JNI_CLASS_NOT_EXIST = IMAGE_RESULT_BASE + 59,<br>IMAGE_RESULT_MEDIA_JNI_METHOD_NOT_EXIST = IMAGE_RESULT_BASE + 60,<br>IMAGE_RESULT_MEDIA_JNI_NEW_OBJ_FAILED = IMAGE_RESULT_BASE + 61,<br>IMAGE_RESULT_MEDIA_JNI_COMMON_ERROR = IMAGE_RESULT_BASE + 62,<br>IMAGE_RESULT_MEDIA_DISTRIBUTE_NOT_SUPPORT = IMAGE_RESULT_BASE + 63,<br>IMAGE_RESULT_MEDIA_SOURCE_NOT_SET = IMAGE_RESULT_BASE + 64,<br>IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_INIT = IMAGE_RESULT_BASE + 65,<br>IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_EXIST = IMAGE_RESULT_BASE + 66,<br>IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT = IMAGE_RESULT_BASE + 67,<br>IMAGE_RESULT_MEDIA_RTSP_CAPTURE_NOT_INIT = IMAGE_RESULT_BASE + 68,<br>IMAGE_RESULT_MEDIA_RTSP_SOURCE_URL_INVALID = IMAGE_RESULT_BASE + 69,<br>IMAGE_RESULT_MEDIA_RTSP_VIDEO_TRACK_NOT_FOUND = IMAGE_RESULT_BASE + 70,<br>IMAGE_RESULT_MEDIA_RTSP_CAMERA_NUM_REACH_MAX = IMAGE_RESULT_BASE + 71,<br>IMAGE_RESULT_MEDIA_SET_VOLUME = IMAGE_RESULT_BASE + 72,<br>IMAGE_RESULT_MEDIA_NUMBER_OVERFLOW = IMAGE_RESULT_BASE + 73,<br>IMAGE_RESULT_MEDIA_DIS_PLAYER_UNSUPPORTED = IMAGE_RESULT_BASE + 74,<br>IMAGE_RESULT_MEDIA_DENCODE_ICC_FAILED = IMAGE_RESULT_BASE + 75,<br>IMAGE_RESULT_MEDIA_ENCODE_ICC_FAILED = IMAGE_RESULT_BASE + 76,<br>IMAGE_RESULT_MEDIA_READ_PIXELMAP_FAILED = IMAGE_RESULT_BASE + 150,<br>IMAGE_RESULT_MEDIA_WRITE_PIXELMAP_FAILED = IMAGE_RESULT_BASE + 151,<br>IMAGE_RESULT_MEDIA_PIXELMAP_NOT_ALLOW_MODIFY = IMAGE_RESULT_BASE + 152,<br>IMAGE_RESULT_MEDIA_CONFIG_FAILED = IMAGE_RESULT_BASE + 153,<br>IMAGE_RESULT_JNI_ENV_ABNORMAL = IMAGE_RESULT_BASE + 154,<br>IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED = IMAGE_RESULT_BASE + 155,<br>IMAGE_RESULT_CREATE_SURFACE_FAILED = IMAGE_RESULT_BASE + 156,<br>IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED = IMAGE_RESULT_BASE + 157,<br>IMAGE_RESULT_GET_SURFACE_FAILED = IMAGE_RESULT_BASE + 158,<br>IMAGE_RESULT_SURFACE_ACQUIRE_BUFFER_FAILED = IMAGE_RESULT_BASE + 159,<br>IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED = IMAGE_RESULT_BASE + 160,<br>IMAGE_RESULT_REGISTER_LISTENER_FAILED = IMAGE_RESULT_BASE + 161,<br>IMAGE_RESULT_REGISTER_BUFFER_FAILED = IMAGE_RESULT_BASE + 162,<br>IMAGE_RESULT_FREAD_FAILED = IMAGE_RESULT_BASE + 163,<br>IMAGE_RESULT_PEEK_FAILED = IMAGE_RESULT_BASE + 164,<br>IMAGE_RESULT_SEEK_FAILED = IMAGE_RESULT_BASE + 165,<br>IMAGE_RESULT_STREAM_SIZE_ERROR = IMAGE_RESULT_BASE + 166,<br>IMAGE_RESULT_FILE_FD_ERROR = IMAGE_RESULT_BASE + 167,<br>IMAGE_RESULT_FILE_DAMAGED = IMAGE_RESULT_BASE + 168,<br>IMAGE_RESULT_CREATE_DECODER_FAILED = IMAGE_RESULT_BASE + 169,<br>IMAGE_RESULT_CREATE_ENCODER_FAILED = IMAGE_RESULT_BASE + 170,<br>IMAGE_RESULT_CHECK_FORMAT_ERROR = IMAGE_RESULT_BASE + 171,<br>IMAGE_RESULT_THIRDPART_SKIA_ERROR = IMAGE_RESULT_BASE + 172,<br>IMAGE_RESULT_HW_DECODE_FAILED = IMAGE_RESULT_BASE + 173,<br>IMAGE_RESULT_ALLOCATER_TYPE_ERROR = IMAGE_RESULT_BASE + 174,<br>IMAGE_RESULT_ALPHA_TYPE_ERROR = IMAGE_RESULT_BASE + 175,<br>IMAGE_RESULT_INDEX_INVALID = IMAGE_RESULT_BASE + 176,<br>IMAGE_RESULT_MEDIA_UNKNOWN = IMAGE_RESULT_BASE + 200<br>} | Enumerates the return values that may be used by the interface.| 
81| { OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN = 0,<br>OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE = 1,<br>OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL = 2,<br>OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL = 3 } | Enumerates the pixel map alpha types.| 
82| { OHOS_PIXEL_MAP_READ_ONLY = 0,<br>OHOS_PIXEL_MAP_EDITABLE = 1 } | Enumerates the pixel map editing types.| 
83| [OH_PixelMap_AntiAliasingLevel](#oh_pixelmap_antialiasinglevel) { <br>OH_PixelMap_AntiAliasing_NONE = 0, <br>OH_PixelMap_AntiAliasing_LOW = 1, <br>OH_PixelMap_AntiAliasing_MEDIUM = 2, <br>OH_PixelMap_AntiAliasing_HIGH = 3 <br>} | Enumerates the antialiasing levels used for scaling pixel maps. | 
84| { OHOS_IMAGE_RESULT_SUCCESS = 0,<br>OHOS_IMAGE_RESULT_BAD_PARAMETER = -1 } | Enumerates the error codes returned by the functions.| 
85| { OHOS_PIXEL_MAP_FORMAT_NONE = 0,<br>OHOS_PIXEL_MAP_FORMAT_RGBA_8888 = 3,<br>OHOS_PIXEL_MAP_FORMAT_RGB_565 = 2 } | Enumerates the pixel map formats.| 
86| { OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE = 0,<br>OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP = 1 } | Enumerates the pixel map scale modes.| 
87
88
89### Functions
90
91| Name| Description| 
92| -------- | -------- |
93| [ImageNative](#imagenative) \* [OH_Image_InitImageNative](#oh_image_initimagenative) (napi_env env, napi_value source) | Converts an **Image** object at the JavaScript native layer into an **ImageNative** object. | 
94| int32_t [OH_Image_ClipRect](#oh_image_cliprect) (const [ImageNative](#imagenative) \*native, struct [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) \*rect) | Obtains [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) of an **ImageNative** object. | 
95| int32_t [OH_Image_Size](#oh_image_size) (const [ImageNative](#imagenative) \*native, struct [OhosImageSize](_ohos_image_size.md) \*size) | Obtains [OhosImageSize](_ohos_image_size.md) of an **ImageNative** object. | 
96| int32_t [OH_Image_Format](#oh_image_format) (const [ImageNative](#imagenative) \*native, int32_t \*format) | Obtains the format of an **ImageNative** object. | 
97| int32_t [OH_Image_GetComponent](#oh_image_getcomponent) (const [ImageNative](#imagenative) \*native, int32_t componentType, struct [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) \*componentNative) | Obtains [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) of an **ImageNative** object. | 
98| int32_t [OH_Image_Release](#oh_image_release) ([ImageNative](#imagenative) \*native) | Releases an **ImageNative** object.  | 
99| int32_t [OH_ImagePacker_Create](#oh_imagepacker_create) (napi_env env, napi_value \*res) | Obtains an **ImagePacker** object at the JavaScript native layer. | 
100| [ImagePacker_Native](#imagepacker_native) \* [OH_ImagePacker_InitNative](#oh_imagepacker_initnative) (napi_env env, napi_value packer) | Converts an **ImagePacker** object at the JavaScript native layer into an **ImagePacker_Native** object. | 
101| int32_t [OH_ImagePacker_PackToData](#oh_imagepacker_packtodata) ([ImagePacker_Native](#imagepacker_native) \*native, napi_value source, [ImagePacker_Opts](#imagepacker_opts) \*opts, uint8_t \*outData, size_t \*size) | Packs a **PixelMap** object or an **ImagePacker** object at the JavaScript native layer to a buffer (defined by **outData**) based on the specified **ImagePacker_Opts** struct.| 
102| int32_t [OH_ImagePacker_PackToFile](#oh_imagepacker_packtofile) ([ImagePacker_Native](#imagepacker_native) \*native, napi_value source, [ImagePacker_Opts](#imagepacker_opts) \*opts, int fd) | Packs a **PixelMap** object or an **ImagePacker** object at the JavaScript native layer to a file based on the specified **ImagePacker_Opts** struct.| 
103| int32_t [OH_ImagePacker_Release](#oh_imagepacker_release) ([ImagePacker_Native](#imagepacker_native) \*native) | Releases an [ImagePacker_Native](#imagepacker_native) object.| 
104| int32_t [OH_PixelMap_CreatePixelMap](#oh_pixelmap_createpixelmap) (napi_env env, [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) info, void \*buf, size_t len, napi_value \*res) | Creates a **PixelMap** object. | 
105| int32_t [OH_PixelMap_CreatePixelMapWithStride](#oh_pixelmap_createpixelmapwithstride) (napi_env env, [OhosPixelMapCreateOps](_ohos_pixel_map_create_ops.md) info, void \*buf, size_t len, int32_t rowStride, napi_value \*res) | Creates a **PixelMap** object. Currently, only BGRA input streams are supported. For a pixel map in RGBA format (with the size greater than 512\*512), DMA memory is used by default. | 
106| int32_t [OH_PixelMap_CreateAlphaPixelMap](#oh_pixelmap_createalphapixelmap) (napi_env env, napi_value source, napi_value \*alpha) | Creates a **PixelMap** object that contains only alpha channel information. | 
107| [NativePixelMap](#nativepixelmap) \* [OH_PixelMap_InitNativePixelMap](#oh_pixelmap_initnativepixelmap) (napi_env env, napi_value source) | Initializes a **PixelMap** object. | 
108| int32_t [OH_PixelMap_GetBytesNumberPerRow](#oh_pixelmap_getbytesnumberperrow) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*num) | Obtains the number of bytes per row of a **NativePixelMap** object. | 
109| int32_t [OH_PixelMap_GetIsEditable](#oh_pixelmap_getiseditable) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*editable) | Checks whether a **NativePixelMap** object is editable. | 
110| int32_t [OH_PixelMap_IsSupportAlpha](#oh_pixelmap_issupportalpha) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*alpha) | Checks whether a **NativePixelMap** object supports alpha channels. | 
111| int32_t [OH_PixelMap_SetAlphaAble](#oh_pixelmap_setalphaable) (const [NativePixelMap](#nativepixelmap) \*native, int32_t alpha) | Sets an alpha channel for a **NativePixelMap** object. | 
112| int32_t [OH_PixelMap_GetDensity](#oh_pixelmap_getdensity) (const [NativePixelMap](#nativepixelmap) \*native, int32_t \*density) | Obtains the pixel density of a **NativePixelMap** object. | 
113| int32_t [OH_PixelMap_SetDensity](#oh_pixelmap_setdensity) (const [NativePixelMap](#nativepixelmap) \*native, int32_t density) | Sets the pixel density for a **NativePixelMap** object. | 
114| int32_t [OH_PixelMap_SetOpacity](#oh_pixelmap_setopacity) (const [NativePixelMap](#nativepixelmap) \*native, float opacity) | Sets the opacity for a **NativePixelMap** object. | 
115| int32_t [OH_PixelMap_Scale](#oh_pixelmap_scale) (const [NativePixelMap](#nativepixelmap) \*native, float x, float y) | Scales a **NativePixelMap** object. | 
116| int32_t [OH_PixelMap_ScaleWithAntiAliasing](#oh_pixelmap_scalewithantialiasing) (const [NativePixelMap](#nativepixelmap) \*native, float x, float y, [OH_PixelMap_AntiAliasingLevel](#oh_pixelmap_antialiasinglevel) level) | Scales an image based on the specified antialiasing level, width, and height. | 
117| int32_t [OH_PixelMap_Translate](#oh_pixelmap_translate) (const [NativePixelMap](#nativepixelmap) \*native, float x, float y) | Translates a **NativePixelMap** object. | 
118| int32_t [OH_PixelMap_Rotate](#oh_pixelmap_rotate) (const [NativePixelMap](#nativepixelmap) \*native, float angle) | Rotates a **NativePixelMap** object. | 
119| int32_t [OH_PixelMap_Flip](#oh_pixelmap_flip) (const [NativePixelMap](#nativepixelmap) \*native, int32_t x, int32_t y) | Flips a **NativePixelMap** object. | 
120| int32_t [OH_PixelMap_Crop](#oh_pixelmap_crop) (const [NativePixelMap](#nativepixelmap) \*native, int32_t x, int32_t y, int32_t width, int32_t height) | Crops a **NativePixelMap** object. | 
121| int32_t [OH_PixelMap_GetImageInfo](#oh_pixelmap_getimageinfo) (const [NativePixelMap](#nativepixelmap) \*native, [OhosPixelMapInfos](_ohos_pixel_map_infos.md) \*info) | Obtains the image information of a **NativePixelMap** object. | 
122| int32_t [OH_PixelMap_AccessPixels](#oh_pixelmap_accesspixels) (const [NativePixelMap](#nativepixelmap) \*native, void \*\*addr) | Obtains the memory address of a **NativePixelMap** object and locks the memory. | 
123| int32_t [OH_PixelMap_UnAccessPixels](#oh_pixelmap_unaccesspixels) (const [NativePixelMap](#nativepixelmap) \*native) | Unlocks the memory of a **NativePixelMap** object. This function is used with [OH_PixelMap_AccessPixels](#oh_pixelmap_accesspixels) in pairs. | 
124| int32_t [OH_GetImageInfo](#oh_getimageinfo) (napi_env env, napi_value value, [OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md) \*info) | Obtains the information about a **PixelMap** object and stores the information to the [OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md) struct. | 
125| int32_t [OH_AccessPixels](#oh_accesspixels) (napi_env env, napi_value value, void \*\*addrPtr) | Obtains the memory address of a **PixelMap** object and locks the memory. | 
126| int32_t [OH_UnAccessPixels](#oh_unaccesspixels) (napi_env env, napi_value value) | Unlocks the memory of a **PixelMap** object. This function is used with **OH_AccessPixels** in pairs. | 
127| int32_t [OH_Image_Receiver_CreateImageReceiver](#oh_image_receiver_createimagereceiver) (napi_env env, struct [OhosImageReceiverInfo](_ohos_image_receiver_info.md) info, napi_value \*res) | Creates an **ImageReceiver** object at the application layer. | 
128| [ImageReceiverNative](#imagereceivernative) \* [OH_Image_Receiver_InitImageReceiverNative](#oh_image_receiver_initimagereceivernative) (napi_env env, napi_value source) | Initializes an [ImageReceiverNative](#imagereceivernative) object through an **ImageReceiver** object. | 
129| int32_t [OH_Image_Receiver_GetReceivingSurfaceId](#oh_image_receiver_getreceivingsurfaceid) (const [ImageReceiverNative](#imagereceivernative) \*native, char \*id, size_t len) | Obtains the receiver ID through an [ImageReceiverNative](#imagereceivernative) object. | 
130| int32_t [OH_Image_Receiver_ReadLatestImage](#oh_image_receiver_readlatestimage) (const [ImageReceiverNative](#imagereceivernative) \*native, napi_value \*image) | Obtains the latest image through an [ImageReceiverNative](#imagereceivernative) object. | 
131| int32_t [OH_Image_Receiver_ReadNextImage](#oh_image_receiver_readnextimage) (const [ImageReceiverNative](#imagereceivernative) \*native, napi_value \*image) | Obtains the next image through an [ImageReceiverNative](#imagereceivernative) object. | 
132| int32_t [OH_Image_Receiver_On](#oh_image_receiver_on) (const [ImageReceiverNative](#imagereceivernative) \*native, [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback) callback) | Registers an [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback) callback. This callback is triggered whenever a new image is received. | 
133| int32_t [OH_Image_Receiver_GetSize](#oh_image_receiver_getsize) (const [ImageReceiverNative](#imagereceivernative) \*native, struct [OhosImageSize](_ohos_image_size.md) \*size) | Obtains the size of the image receiver through an [ImageReceiverNative](#imagereceivernative) object. | 
134| int32_t [OH_Image_Receiver_GetCapacity](#oh_image_receiver_getcapacity) (const [ImageReceiverNative](#imagereceivernative) \*native, int32_t \*capacity) | Obtains the capacity of the image receiver through an [ImageReceiverNative](#imagereceivernative) object. | 
135| int32_t [OH_Image_Receiver_GetFormat](#oh_image_receiver_getformat) (const [ImageReceiverNative](#imagereceivernative) \*native, int32_t \*format) | Obtains the format of the image receiver through an [ImageReceiverNative](#imagereceivernative) object. | 
136| int32_t [OH_Image_Receiver_Release](#oh_image_receiver_release) ([ImageReceiverNative](#imagereceivernative) \*native) | Releases an [ImageReceiverNative](#imagereceivernative) object.| 
137| int32_t [OH_ImageSource_Create](#oh_imagesource_create) (napi_env env, struct [OhosImageSource](_ohos_image_source.md) \*src, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified [OhosImageSource](_ohos_image_source.md) and [OhosImageSourceOps](_ohos_image_source_ops.md) structs. | 
138| int32_t [OH_ImageSource_CreateFromUri](#oh_imagesource_createfromuri) (napi_env env, char \*uri, size_t size, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified URI and [OhosImageSourceOps](_ohos_image_source_ops.md) struct. | 
139| int32_t [OH_ImageSource_CreateFromFd](#oh_imagesource_createfromfd) (napi_env env, int32_t fd, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified file descriptor and [OhosImageSourceOps](_ohos_image_source_ops.md) struct. | 
140| int32_t [OH_ImageSource_CreateFromData](#oh_imagesource_createfromdata) (napi_env env, uint8_t \*data, size_t dataSize, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified image source buffer (defined by **data**) and [OhosImageSourceOps](_ohos_image_source_ops.md) struct. | 
141| int32_t [OH_ImageSource_CreateFromRawFile](#oh_imagesource_createfromrawfile) (napi_env env, RawFileDescriptor rawFile, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object at the JavaScript native layer based on the specified raw file descriptor and [OhosImageSourceOps](_ohos_image_source_ops.md) struct. | 
142| int32_t [OH_ImageSource_CreateIncremental](#oh_imagesource_createincremental) (napi_env env, struct [OhosImageSource](_ohos_image_source.md) \*source, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object of the incremental type at the JavaScript native layer based on the specified [OhosImageSource](_ohos_image_source.md) and [OhosImageSourceOps](_ohos_image_source_ops.md) structs. | 
143| int32_t [OH_ImageSource_CreateIncrementalFromData](#oh_imagesource_createincrementalfromdata) (napi_env env, uint8_t \*data, size_t dataSize, struct [OhosImageSourceOps](_ohos_image_source_ops.md) \*ops, napi_value \*res) | Creates an **ImageSource** object of the incremental type at the JavaScript native layer based on the specified image source buffer (defined by **data**) and [OhosImageSourceOps](_ohos_image_source_ops.md) struct. The image data is updated through **OH_ImageSource_UpdateData**.  | 
144| int32_t [OH_ImageSource_GetSupportedFormats](#oh_imagesource_getsupportedformats) (struct [OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md) \*res) | Obtains all supported decoding formats. | 
145| [ImageSourceNative](#imagesourcenative) \* [OH_ImageSource_InitNative](#oh_imagesource_initnative) (napi_env env, napi_value source) | Converts an **ImageSource** object at the JavaScript native layer into an [ImageSourceNative](#imagesourcenative) object. | 
146| int32_t [OH_ImageSource_CreatePixelMap](#oh_imagesource_createpixelmap) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageDecodingOps](_ohos_image_decoding_ops.md) \*ops, napi_value \*res) | Decodes an **ImageSourceNative** object to obtain a **PixelMap** object at the JavaScript native layer based on the specified [OhosImageDecodingOps](_ohos_image_decoding_ops.md) struct. | 
147| int32_t [OH_ImageSource_CreatePixelMapList](#oh_imagesource_createpixelmaplist) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageDecodingOps](_ohos_image_decoding_ops.md) \*ops, napi_value \*res) | Decodes an **ImageSourceNative** object to obtain all **PixelMap** objects at the JavaScript native layer based on the specified [OhosImageDecodingOps](_ohos_image_decoding_ops.md) struct. | 
148| int32_t [OH_ImageSource_GetDelayTime](#oh_imagesource_getdelaytime) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md) \*res) | Obtains the delay time list from an **ImageSourceNative** object (such as GIF image source). | 
149| int32_t [OH_ImageSource_GetFrameCount](#oh_imagesource_getframecount) (const [ImageSourceNative](#imagesourcenative) \*native, uint32_t \*res) | Obtains the number of frames from an **ImageSourceNative** object. | 
150| int32_t [OH_ImageSource_GetImageInfo](#oh_imagesource_getimageinfo) (const [ImageSourceNative](#imagesourcenative) \*native, int32_t index, struct [OhosImageSourceInfo](_ohos_image_source_info.md) \*info) | Obtains image source information from an **ImageSourceNative** object by index. | 
151| int32_t [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageSourceProperty](_ohos_image_source_property.md) \*key, struct [OhosImageSourceProperty](_ohos_image_source_property.md) \*value) | Obtains the value of an image property from an **ImageSourceNative** object. | 
152| int32_t [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageSourceProperty](_ohos_image_source_property.md) \*key, struct [OhosImageSourceProperty](_ohos_image_source_property.md) \*value) | Modifies the value of an image property of an **ImageSourceNative** object. | 
153| int32_t [OH_ImageSource_UpdateData](#oh_imagesource_updatedata) (const [ImageSourceNative](#imagesourcenative) \*native, struct [OhosImageSourceUpdateData](_ohos_image_source_update_data.md) \*data) | Updates the data of an **ImageSourceNative** object. | 
154| int32_t [OH_ImageSource_Release](#oh_imagesource_release) ([ImageSourceNative](#imagesourcenative) \*native) | Releases an **ImageSourceNative** object. | 
155
156
157### Variables
158
159| Name| Description| 
160| -------- | -------- |
161| const char \* [OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE](#ohos_image_property_bits_per_sample) = "BitsPerSample" | Defines a pointer to bits per sample, one of the image properties. | 
162| const char \* [OHOS_IMAGE_PROPERTY_ORIENTATION](#ohos_image_property_orientation) = "Orientation" | Defines a pointer to the orientation, one of the image properties. | 
163| const char \* [OHOS_IMAGE_PROPERTY_IMAGE_LENGTH](#ohos_image_property_image_length) = "ImageLength" | Defines a pointer to the image length, one of the image properties. | 
164| const char \* [OHOS_IMAGE_PROPERTY_IMAGE_WIDTH](#ohos_image_property_image_width) = "ImageWidth" | Defines a pointer to the image width, one of the image properties. | 
165| const char \* [OHOS_IMAGE_PROPERTY_GPS_LATITUDE](#ohos_image_property_gps_latitude) = "GPSLatitude" | Defines a pointer to the GPS latitude, one of the image properties. | 
166| const char \* [OHOS_IMAGE_PROPERTY_GPS_LONGITUDE](#ohos_image_property_gps_longitude) = "GPSLongitude" | Defines a pointer to the GPS longitude, one of the image properties. | 
167| const char \* [OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF](#ohos_image_property_gps_latitude_ref) = "GPSLatitudeRef" | Defines a pointer to the GPS latitude reference information, one of the image properties. | 
168| const char \* [OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF](#ohos_image_property_gps_longitude_ref) = "GPSLongitudeRef" | Defines a pointer to the GPS longitude reference information, one of the image properties. | 
169| const char \* [OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL](#ohos_image_property_date_time_original) = "DateTimeOriginal" | Defines a pointer to the created date and time, one of the image properties. | 
170| const char \* [OHOS_IMAGE_PROPERTY_EXPOSURE_TIME](#ohos_image_property_exposure_time) = "ExposureTime" | Defines a pointer to the exposure time, one of the image properties. | 
171| const char \* [OHOS_IMAGE_PROPERTY_SCENE_TYPE](#ohos_image_property_scene_type) = "SceneType" | Defines a pointer to the scene type, one of the image properties. | 
172| const char \* [OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS](#ohos_image_property_iso_speed_ratings) = "ISOSpeedRatings" | Defines a pointer to the ISO speed ratings, one of the image properties. | 
173| const char \* [OHOS_IMAGE_PROPERTY_F_NUMBER](#ohos_image_property_f_number) = "FNumber" | Defines a pointer to the f-number of the image, one of the image properties. | 
174| const char \* [OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL](#ohos_image_property_compressed_bits_per_pixel) = "CompressedBitsPerPixel" | Defines a pointer to the compressed bits per pixel, one of the image properties. | 
175| int32_t [OhosImageRegion::x](#x) | Defines the X coordinate of the start point, in pixels. | 
176| int32_t [OhosImageRegion::y](#y) | Defines the Y coordinate of the start point, in pixels. | 
177| int32_t [OhosImageRegion::width](#width) | Defines the width of the region, in pixels. | 
178| int32_t [OhosImageRegion::height](#height) | Defines the height of the region, in pixels. | 
179| int32_t [OhosImageSourceOps::density](#density-12) | Defines the pixel density of the image source. | 
180| int32_t [OhosImageSourceOps::pixelFormat](#pixelformat-13) | Defines the pixel format of the image source. It is usually used to describe the YUV buffer. | 
181| struct [OhosImageSize](_ohos_image_size.md) [OhosImageSourceOps::size](#size-17) | Defines the pixel width and height of the image source. | 
182| int8_t [OhosImageDecodingOps::editable](#editable) | Defines whether the output pixel map is editable. | 
183| int32_t [OhosImageDecodingOps::pixelFormat](#pixelformat-23) | Defines the pixel format of the output pixel map. | 
184| int32_t [OhosImageDecodingOps::fitDensity](#fitdensity) | Defines the pixel density of the output pixel map. | 
185| uint32_t [OhosImageDecodingOps::index](#index) | Defines the index of the output pixel map. | 
186| uint32_t [OhosImageDecodingOps::sampleSize](#samplesize) | Defines the size of the sample. | 
187| uint32_t [OhosImageDecodingOps::rotate](#rotate) | Defines the decoding rotation options. | 
188| struct [OhosImageSize](_ohos_image_size.md) [OhosImageDecodingOps::size](#size-27) | Defines the pixel width and height of the output pixel map. | 
189| struct [OhosImageRegion](_ohos_image_region.md) [OhosImageDecodingOps::region](#region) | Defines the region of the output pixel map. | 
190| int32_t [OhosImageSourceInfo::pixelFormat](#pixelformat-33) | Defines the pixel format of the image source. It is set in [OH_ImageSource_Create](#oh_imagesource_create). | 
191| int32_t [OhosImageSourceInfo::colorSpace](#colorspace) | Defines the color space of the image source. | 
192| int32_t [OhosImageSourceInfo::alphaType](#alphatype) | Defines the alpha type of the image source. | 
193| int32_t [OhosImageSourceInfo::density](#density-22) | Defines the image density of the image source. It is set in [OH_ImageSource_Create](#oh_imagesource_create). | 
194| struct [OhosImageSize](_ohos_image_size.md) [OhosImageSourceInfo::size](#size-37) | Defines the pixel width and height of the image source. | 
195| char \* [OhosImageSource::uri](#uri) = nullptr | Defines a pointer to the image source URI. Only a file URI or Base64 URI is accepted. | 
196| size_t [OhosImageSource::uriSize](#urisize) = 0 | Defines the length of the image source URI. | 
197| int32_t [OhosImageSource::fd](#fd) = -1 | Defines the descriptor of the image source. | 
198| uint8_t \* [OhosImageSource::buffer](#buffer-12) = nullptr | Defines a pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted. | 
199| size_t [OhosImageSource::bufferSize](#buffersize-12) = 0 | Defines the size of the image source buffer. | 
200| int32_t \* [OhosImageSourceDelayTimeList::delayTimeList](#delaytimelist) | Defines a pointer to the head of the image source delay time list. | 
201| size_t [OhosImageSourceDelayTimeList::size](#size-47) = 0 | Defines the size of the image source delay time list. | 
202| char \* [OhosImageSourceSupportedFormat::format](#format) = nullptr | Defines a pointer to the head of the format string. | 
203| size_t [OhosImageSourceSupportedFormat::size](#size-57) = 0 | Defines the size of the format string. | 
204| struct [OhosImageSourceSupportedFormat](_ohos_image_source_supported_format.md) \*\* [OhosImageSourceSupportedFormatList::supportedFormatList](#supportedformatlist) = nullptr | Defines a double pointer to the head of the format string list. | 
205| size_t [OhosImageSourceSupportedFormatList::size](#size-67) = 0 | Defines the size of the format string list. | 
206| char \* [OhosImageSourceProperty::value](#value) = nullptr | Defines a pointer to the head of the property string. | 
207| size_t [OhosImageSourceProperty::size](#size-77) = 0 | Defines the size of the property string. | 
208| uint8_t \* [OhosImageSourceUpdateData::buffer](#buffer-22) = nullptr | Defines a pointer to the buffer for storing the update data. | 
209| size_t [OhosImageSourceUpdateData::bufferSize](#buffersize-22) = 0 | Defines the size of the buffer. | 
210| uint32_t [OhosImageSourceUpdateData::offset](#offset) = 0 | Defines the offset of the update data in the buffer. | 
211| uint32_t [OhosImageSourceUpdateData::updateLength](#updatelength) = 0 | Defines the length of the update data in the buffer. | 
212| int8_t [OhosImageSourceUpdateData::isCompleted](#iscompleted) = 0 | Defines whether the image source data update is completed. | 
213
214
215## Type Description
216
217
218### ImageNative
219
220```
221typedef struct ImageNative_ ImageNative
222```
223
224**Description**
225
226Defines an image object at the native layer.
227
228**Since**: 10
229
230
231### ImagePacker_Native
232
233```
234typedef struct ImagePacker_Native_ ImagePacker_Native
235```
236
237**Description**
238
239Defines an image packer object at the native layer.
240
241**Since**: 11
242
243
244### ImagePacker_Opts
245
246```
247typedef struct ImagePacker_Opts_ ImagePacker_Opts
248```
249
250**Description**
251
252Defines the alias of the image packing options.
253
254**Since**: 11
255
256
257### ImageReceiverNative
258
259```
260typedef struct ImageReceiverNative_ ImageReceiverNative
261```
262
263**Description**
264
265Defines the data type name of the image receiver at the native layer.
266
267**Since**: 10
268
269
270### ImageSourceNative
271
272```
273typedef struct ImageSourceNative_ ImageSourceNative
274```
275
276**Description**
277
278Defines an image source object at the native layer.
279
280**System capability**: SystemCapability.Multimedia.Image
281
282**Since**: 10
283
284
285### NativePixelMap
286
287```
288typedef struct NativePixelMap_ NativePixelMap
289```
290
291**Description**
292
293Defines the data type name of the pixel map at the native layer.
294
295**Since**: 10
296
297
298### OH_Image_Receiver_On_Callback
299
300```
301typedef void(* OH_Image_Receiver_On_Callback) ()
302```
303
304**Description**
305
306Defines the callbacks for the image interface at the native layer.
307
308**Since**: 10
309
310
311### OhosPixelMapInfos
312
313```
314typedef struct OhosPixelMapInfos
315```
316
317**Description**
318
319Defines the information about a pixel map.
320
321**Since**: 10
322
323
324## Enum Description
325
326
327### anonymous enum [1/3]
328
329```
330anonymous enum
331```
332
333**Description**
334
335Enumerates the image formats.
336
337**Since**: 10
338
339| Value| Description| 
340| -------- | -------- |
341| OHOS_IMAGE_FORMAT_YCBCR_422_SP | YCbCr422 semi-planar format.| 
342| OHOS_IMAGE_FORMAT_JPEG | JPEG encoding format.| 
343
344
345### anonymous enum [2/3]
346
347```
348anonymous enum
349```
350
351**Description**
352
353Enumerates the pixel map alpha types.
354
355**Since**: 10
356
357| Value| Description| 
358| -------- | -------- |
359| OHOS_PIXEL_MAP_ALPHA_TYPE_UNKNOWN  | Unknown format.  | 
360| OHOS_PIXEL_MAP_ALPHA_TYPE_OPAQUE  | Opaque format.  | 
361| OHOS_PIXEL_MAP_ALPHA_TYPE_PREMUL  | Premultiplied format.  | 
362| OHOS_PIXEL_MAP_ALPHA_TYPE_UNPREMUL  | Unpremultiplied format.  | 
363
364
365### anonymous enum [3/3]
366
367```
368anonymous enum
369```
370
371**Description**
372
373Enumerates the error codes returned by the functions.
374
375**Deprecated from**: 10
376
377**Since**: 8
378
379| Value| Description| 
380| -------- | -------- |
381| OHOS_IMAGE_RESULT_SUCCESS | Operation success.| 
382| OHOS_IMAGE_RESULT_BAD_PARAMETER | Invalid parameter.| 
383
384
385### anonymous enum [1/3]
386
387```
388anonymous enum
389```
390
391**Description**
392
393Enumerates the image components.
394
395**Since**: 10
396
397| Value| Description| 
398| -------- | -------- |
399| OHOS_IMAGE_COMPONENT_FORMAT_YUV_Y | Luminance component.| 
400| OHOS_IMAGE_COMPONENT_FORMAT_YUV_U | Chrominance component - blue projection.| 
401| OHOS_IMAGE_COMPONENT_FORMAT_YUV_V | Chrominance component - red projection.| 
402| OHOS_IMAGE_COMPONENT_FORMAT_JPEG | JPEG format.| 
403
404
405### anonymous enum [2/3]
406
407```
408anonymous enum
409```
410
411**Description**
412
413Enumerates the pixel map editing types.
414
415**Since**: 10
416
417| Value| Description| 
418| -------- | -------- |
419| OHOS_PIXEL_MAP_READ_ONLY  | Read-only.  | 
420| OHOS_PIXEL_MAP_EDITABLE  | Editable.  | 
421
422
423### anonymous enum [3/3]
424
425```
426anonymous enum
427```
428
429**Description**
430
431Enumerates the pixel map formats.
432
433**Deprecated from**: 10
434
435**Since**: 8
436
437| Value| Description| 
438| -------- | -------- |
439| OHOS_IMAGE_COMPONENT_FORMAT_YUV_Y  | Luminance component.  | 
440| OHOS_IMAGE_COMPONENT_FORMAT_YUV_U  | Chrominance component - blue projection.  | 
441| OHOS_IMAGE_COMPONENT_FORMAT_YUV_V  | Chrominance component - red projection.  | 
442| OHOS_IMAGE_COMPONENT_FORMAT_JPEG  | JPEG format.  | 
443
444
445### anonymous enum
446
447```
448anonymous enum
449```
450
451**Description**
452
453Enumerates the pixel map scale modes.
454
455**Since**: 10
456
457| Value| Description| 
458| -------- | -------- |
459| OHOS_PIXEL_MAP_SCALE_MODE_FIT_TARGET_SIZE  | Adapting to the target image size.  | 
460| OHOS_PIXEL_MAP_SCALE_MODE_CENTER_CROP  | Cropping the center portion of an image to the target size.  | 
461
462
463### IRNdkErrCode
464
465```
466enum IRNdkErrCode
467```
468
469**Description**
470
471Enumerates the return values that may be used by the interface.
472
473**Since**: 10
474
475
476| Value| Description| 
477| -------- | -------- |
478| IMAGE_RESULT_SUCCESS | Operation success.| 
479| IMAGE_RESULT_BAD_PARAMETER | Invalid parameter.| 
480| IMAGE_RESULT_IMAGE_RESULT_BASE | Operation failed.| 
481| IMAGE_RESULT_ERR_IPC | IPC error.| 
482| IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST | Failed to share the memory.| 
483| IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL | Abnormal data in the shared memory.| 
484| IMAGE_RESULT_DECODE_ABNORMAL | Failed to decode the image.| 
485| IMAGE_RESULT_DATA_ABNORMAL | Abnormal input data.| 
486| IMAGE_RESULT_MALLOC_ABNORMAL | An error occurs during memory allocation.| 
487| IMAGE_RESULT_DATA_UNSUPPORT | The image type is not supported.| 
488| IMAGE_RESULT_INIT_ABNORMAL | Failed to initialize the image.| 
489| IMAGE_RESULT_GET_DATA_ABNORMAL | An error occurs during image data retrieval.| 
490| IMAGE_RESULT_TOO_LARGE | The image is too large.| 
491| IMAGE_RESULT_TRANSFORM | An error occurs during image transformation.| 
492| IMAGE_RESULT_COLOR_CONVERT | An error occurs during image color conversion.| 
493| IMAGE_RESULT_CROP | An error occurs during image cropping.| 
494| IMAGE_RESULT_SOURCE_DATA | The image source data is incorrect.| 
495| IMAGE_RESULT_SOURCE_DATA_INCOMPLETE | The image source data is incomplete.| 
496| IMAGE_RESULT_MISMATCHED_FORMAT | The image format does not match.| 
497| IMAGE_RESULT_UNKNOWN_FORMAT | Unknown image format.| 
498| IMAGE_RESULT_SOURCE_UNRESOLVED | The image source is not parsed.| 
499| IMAGE_RESULT_INVALID_PARAMETER | Invalid image parameter.| 
500| IMAGE_RESULT_DECODE_FAILED | Failed to decode the image.| 
501| IMAGE_RESULT_PLUGIN_REGISTER_FAILED | Failed to register the plug-in.| 
502| IMAGE_RESULT_PLUGIN_CREATE_FAILED | Failed to create the plug-in.| 
503| IMAGE_RESULT_ENCODE_FAILED | Failed to encode the image.| 
504| IMAGE_RESULT_ADD_PIXEL_MAP_FAILED | Failed to add the pixel map.| 
505| IMAGE_RESULT_HW_DECODE_UNSUPPORT | Hardware decoding is not supported.| 
506| IMAGE_RESULT_DECODE_HEAD_ABNORMAL | Failed to decode the image header.| 
507| IMAGE_RESULT_DECODE_EXIF_UNSUPPORT | Exchangeable Image File (EXIF) is not supported for image decoding.| 
508| IMAGE_RESULT_PROPERTY_NOT_EXIST | The image property does not exist.| 
509| IMAGE_RESULT_MEDIA_DATA_UNSUPPORT | The media type is not supported.| 
510| IMAGE_RESULT_MEDIA_TOO_LARGE | The media is too large.| 
511| IMAGE_RESULT_MEDIA_MALLOC_FAILED | Memory allocation failed.| 
512| IMAGE_RESULT_MEDIA_END_OF_STREAM | Failed to end the media data stream.| 
513| IMAGE_RESULT_MEDIA_IO_ABNORMAL | Abnormal input and output streams.| 
514| IMAGE_RESULT_MEDIA_MALFORMED | The media service functions abnormally.| 
515| IMAGE_RESULT_MEDIA_BUFFER_TOO_SMALL | The media data is too small.| 
516| IMAGE_RESULT_MEDIA_OUT_OF_RANGE | The media is out of range.| 
517| IMAGE_RESULT_MEDIA_STATUS_ABNORMAL | Abnormal media status.| 
518| IMAGE_RESULT_MEDIA_VALUE_INVALID | Invalid media value.| 
519| IMAGE_RESULT_MEDIA_NULL_POINTER | Media operation failed.| 
520| IMAGE_RESULT_MEDIA_INVALID_OPERATION | Invalid media operation.| 
521| IMAGE_RESULT_MEDIA_ERR_PLAYER_NOT_INIT | An error occurs during media initialization.| 
522| IMAGE_RESULT_MEDIA_EARLY_PREPARE | Media preprocessing is carried out too early.| 
523| IMAGE_RESULT_MEDIA_SEEK_ERR | The seek operation failed.| 
524| IMAGE_RESULT_MEDIA_PERMISSION_DENIED | Permission denied.| 
525| IMAGE_RESULT_MEDIA_DEAD_OBJECT | The media object is deregistered.| 
526| IMAGE_RESULT_MEDIA_TIMED_OUT | A timeout occurs.| 
527| IMAGE_RESULT_MEDIA_TRACK_NOT_ALL_SUPPORTED | The media capability is not supported.| 
528| IMAGE_RESULT_MEDIA_ADAPTER_INIT_FAILED | Failed to initialize the media adapter.| 
529| IMAGE_RESULT_MEDIA_WRITE_PARCEL_FAIL | Failed to write data to the parcel.| 
530| IMAGE_RESULT_MEDIA_READ_PARCEL_FAIL | Failed to read data from the parcel.| 
531| IMAGE_RESULT_MEDIA_NO_AVAIL_BUFFER | Invalid data.| 
532| IMAGE_RESULT_MEDIA_INVALID_PARAM | Invalid parameters.| 
533| IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_EXIST | The media codec adapter does not exist.| 
534| IMAGE_RESULT_MEDIA_CREATE_CODEC_ADAPTER_FAILED | Failed to create the media codec adapter.| 
535| IMAGE_RESULT_MEDIA_CODEC_ADAPTER_NOT_INIT | The media codec adapter is not initialized.| 
536| IMAGE_RESULT_MEDIA_ZCODEC_CREATE_FAILED | Failed to create the media codec.| 
537| IMAGE_RESULT_MEDIA_ZCODEC_NOT_EXIST | The media codec does not exist.| 
538| IMAGE_RESULT_MEDIA_JNI_CLASS_NOT_EXIST | The media JNI layer class does not exist.| 
539| IMAGE_RESULT_MEDIA_JNI_METHOD_NOT_EXIST | The media JNI layer method does not exist.| 
540| IMAGE_RESULT_MEDIA_JNI_NEW_OBJ_FAILED | Failed to create the object at the media JNI layer.| 
541| IMAGE_RESULT_MEDIA_JNI_COMMON_ERROR | The media JNI layer is abnormal.| 
542| IMAGE_RESULT_MEDIA_DISTRIBUTE_NOT_SUPPORT | The distributed feature is not supported.| 
543| IMAGE_RESULT_MEDIA_SOURCE_NOT_SET | The media source is not set.| 
544| IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_INIT | The media RTSP adapter is not initialized.| 
545| IMAGE_RESULT_MEDIA_RTSP_ADAPTER_NOT_EXIST | The media RTSP adapter does not exist.| 
546| IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT | The media does not support the RTSP surface.| 
547| IMAGE_RESULT_MEDIA_RTSP_CAPTURE_NOT_INIT | Failed to initialize the media RTSP capturer.| 
548| IMAGE_RESULT_MEDIA_RTSP_SOURCE_URL_INVALID | Invalid media RTSP source path.| 
549| IMAGE_RESULT_MEDIA_RTSP_VIDEO_TRACK_NOT_FOUND | No video capability is found in the media RTSP.| 
550| IMAGE_RESULT_MEDIA_RTSP_CAMERA_NUM_REACH_MAX | The maximum number of RTSP cameras has been reached.| 
551| IMAGE_RESULT_MEDIA_SET_VOLUME | Failed to set the volume.| 
552| IMAGE_RESULT_MEDIA_NUMBER_OVERFLOW | The number of operations overflows.| 
553| IMAGE_RESULT_MEDIA_DIS_PLAYER_UNSUPPORTED | The distributed media player is not supported.| 
554| IMAGE_RESULT_MEDIA_DENCODE_ICC_FAILED | Failed to decode the ICC.| 
555| IMAGE_RESULT_MEDIA_ENCODE_ICC_FAILED | Failed to encode the ICC.| 
556| IMAGE_RESULT_MEDIA_READ_PIXELMAP_FAILED | Failed to read the pixel map.| 
557| IMAGE_RESULT_MEDIA_WRITE_PIXELMAP_FAILED | Failed to write the pixel map.| 
558| IMAGE_RESULT_MEDIA_PIXELMAP_NOT_ALLOW_MODIFY | The pixel map cannot be modified.| 
559| IMAGE_RESULT_MEDIA_CONFIG_FAILED | Configuration failed.| 
560| IMAGE_RESULT_JNI_ENV_ABNORMAL | The JNI environment is abnormal.| 
561| IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED | Failed to allocate memory for the surface.| 
562| IMAGE_RESULT_CREATE_SURFACE_FAILED | Failed to create the surface.| 
563| IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED | Failed to obtain parameters from the surface.| 
564| IMAGE_RESULT_GET_SURFACE_FAILED | Failed to obtain the surface.| 
565| IMAGE_RESULT_SURFACE_ACQUIRE_BUFFER_FAILED | Failed to apply for a buffer.| 
566| IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED | Failed to request a buffer.| 
567| IMAGE_RESULT_REGISTER_LISTENER_FAILED | Failed to register the listener.| 
568| IMAGE_RESULT_REGISTER_BUFFER_FAILED | Failed to register the buffer.| 
569| IMAGE_RESULT_FREAD_FAILED | Failed to read the file.| 
570| IMAGE_RESULT_PEEK_FAILED | Failed to peek the file.| 
571| IMAGE_RESULT_SEEK_FAILED | Failed to seek the file.| 
572| IMAGE_RESULT_STREAM_SIZE_ERROR | The data stream is damaged.| 
573| IMAGE_RESULT_FILE_FD_ERROR | The file descriptor is damaged.| 
574| IMAGE_RESULT_FILE_DAMAGED | The file is damaged.| 
575| IMAGE_RESULT_CREATE_DECODER_FAILED | Failed to create a decoder.| 
576| IMAGE_RESULT_CREATE_ENCODER_FAILED | Failed to create an encoder.| 
577| IMAGE_RESULT_CHECK_FORMAT_ERROR | Failed to check the format.| 
578| IMAGE_RESULT_THIRDPART_SKIA_ERROR | Skia decoding failed.| 
579| IMAGE_RESULT_HW_DECODE_FAILED | Hardware decoding failed.| 
580| IMAGE_RESULT_ALLOCATER_TYPE_ERROR | Failed to verify the memory type.| 
581| IMAGE_RESULT_ALPHA_TYPE_ERROR | Failed to verify the alpha type.| 
582| IMAGE_RESULT_INDEX_INVALID | Invalid parameter.| 
583| IMAGE_RESULT_MEDIA_UNKNOWN | Unknown error.| 
584
585
586### OH_PixelMap_AntiAliasingLevel
587
588```
589enum OH_PixelMap_AntiAliasingLevel
590```
591
592**Description**
593
594Enumerates the antialiasing levels used for scaling pixel maps.
595
596**Since**: 12
597
598| Value| Description| 
599| -------- | -------- |
600| OH_PixelMap_AntiAliasing_NONE  | Nearest neighbor.  | 
601| OH_PixelMap_AntiAliasing_LOW  | Bilinear interpolation.  | 
602| OH_PixelMap_AntiAliasing_MEDIUM  | Bilinear interpolation with mipmap enabled.  | 
603| OH_PixelMap_AntiAliasing_HIGH  | Cubic convolution.  | 
604
605
606## Function Description
607
608
609### OH_AccessPixels()
610
611```
612int32_t OHOS::Media::OH_AccessPixels (napi_env env, napi_value value, void ** addrPtr )
613```
614
615**Description**
616
617Obtains the memory address of a **PixelMap** object and locks the memory.
618
619**\*addrPtr** is the memory address obtained. After finishing the access, you must use **OH_UnAccessPixels** to unlock the memory. Then the memory cannot be accessed or operated.
620
621**Deprecated from**: 10
622
623**Since**: 8
624
625**Parameters**
626
627| Name| Description| 
628| -------- | -------- |
629| env | Pointer to the NAPI environment. | 
630| value | **PixelMap** object at the application layer. | 
631| addrPtr | Double pointer to the memory address. | 
632
633**See**
634
635UnAccessPixels
636
637**Returns**
638
639Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful; returns an error code otherwise.
640
641
642### OH_GetImageInfo()
643
644```
645int32_t OH_GetImageInfo (napi_env env, napi_value value, OhosPixelMapInfo * info )
646```
647
648**Description**
649
650Obtains the information about a **PixelMap** object and stores the information to the [OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md) struct.
651
652**Deprecated from**: 10
653
654**Since**: 8
655
656**Parameters**
657
658| Name| Description| 
659| -------- | -------- |
660| env | Pointer to the NAPI environment. | 
661| value | **PixelMap** object at the application layer. | 
662| info | Pointer to the object that stores the information obtained. For details, see [OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md). | 
663
664**Returns**
665
666Returns **0** if the information is obtained and stored successfully; returns an error code otherwise.
667
668**See**
669
670[OhosPixelMapInfo](_o_h_o_s_1_1_media_1_1_ohos_pixel_map_info.md)
671
672
673### OH_Image_ClipRect()
674
675```
676int32_t OH_Image_ClipRect (const ImageNative * native, struct OhosImageRect * rect )
677```
678
679**Description**
680
681Obtains [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) of an **ImageNative** object.
682
683**Since**: 10
684
685**Parameters**
686
687| Name| Description| 
688| -------- | -------- |
689| native | Pointer to an **ImageNative** object. | 
690| rect | Pointer to the [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md) object obtained. | 
691
692**Returns**
693
694For details, see [IRNdkErrCode](#irndkerrcode-1).
695
696Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
697
698Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
699
700Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
701
702Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
703
704Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
705
706**See**
707
708[ImageNative](image.md#imagenative), [OhosImageRect](_o_h_o_s_1_1_media_1_1_ohos_image_rect.md)
709
710
711### OH_Image_Format()
712
713```
714int32_t OH_Image_Format (const ImageNative * native, int32_t * format )
715```
716
717**Description**
718
719Obtains the format of an **ImageNative** object.
720
721**Since**: 10
722
723**Parameters**
724
725| Name| Description| 
726| -------- | -------- |
727| native | Pointer to an **ImageNative** object. | 
728| format | Pointer to the image format obtained. | 
729
730**Returns**
731
732For details, see [IRNdkErrCode](#irndkerrcode-1).
733
734Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
735
736Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
737
738Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
739
740Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
741
742Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
743
744
745**See**
746
747[ImageNative](image.md#imagenative)
748
749
750### OH_Image_GetComponent()
751
752```
753int32_t OH_Image_GetComponent (const ImageNative * native, int32_t componentType, struct OhosImageComponent * componentNative )
754```
755
756**Description**
757
758Obtains [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) of an **ImageNative** object.
759
760**Since**: 10
761
762**Parameters**
763
764| Name| Description| 
765| -------- | -------- |
766| native | Pointer to an **ImageNative** object. | 
767| componentType | Type of the component. | 
768| componentNative | Pointer to the [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md) object obtained. | 
769
770**Returns**
771
772For details, see [IRNdkErrCode](#irndkerrcode-1).
773
774Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
775
776Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
777
778Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
779
780Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
781
782Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
783
784**See**
785
786[ImageNative](image.md#imagenative), [OhosImageComponent](_o_h_o_s_1_1_media_1_1_ohos_image_component.md)
787
788
789### OH_Image_InitImageNative()
790
791```
792ImageNative* OH_Image_InitImageNative (napi_env env, napi_value source )
793```
794
795**Description**
796
797Parses an **ImageNative** object from an **Image** object at the JavaScript native layer.
798
799**Since**: 10
800
801**Parameters**
802
803| Name| Description| 
804| -------- | -------- |
805| env | Pointer to the JNI environment. | 
806| source | **Image** object at the JavaScript native layer. | 
807
808**Returns**
809
810Returns a pointer to the **ImageNative** object if the operation is successful; returns a null pointer otherwise.
811
812**See**
813
814[ImageNative](image.md#imagenative), [OH_Image_Release](image.md#oh_image_release)
815
816
817### OH_Image_Receiver_CreateImageReceiver()
818
819```
820int32_t OH_Image_Receiver_CreateImageReceiver (napi_env env, struct OhosImageReceiverInfo info, napi_value * res )
821```
822
823**Description**
824
825Creates an **ImageReceiver** object at the application layer.
826
827**Since**: 10
828
829**Parameters**
830
831| Name| Description| 
832| -------- | -------- |
833| env | Pointer to the NAPI environment. | 
834| info | Options for setting the **ImageReceiver** object. | 
835| res | Pointer to the **ImageReceiver** object at the application layer. | 
836
837**Returns**
838
839For details, see [IRNdkErrCode](#irndkerrcode-1).
840
841Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
842
843Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
844
845Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
846
847Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
848
849Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
850
851Returns **IMAGE_RESULT_CREATE_SURFACE_FAILED** if the surface fails to be created.
852
853Returns **IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED** if the buffer fails to be allocated to the surface.
854
855Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
856
857Returns **IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT** if the media RTSP surface is not supported.
858
859Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
860
861Returns **IMAGE_RESULT_MEDIA_DATA_UNSUPPORT** if the media type is not supported.
862
863
864**See**
865
866[OhosImageReceiverInfo](_ohos_image_receiver_info.md)
867
868
869### OH_Image_Receiver_GetCapacity()
870
871```
872int32_t OH_Image_Receiver_GetCapacity (const ImageReceiverNative * native, int32_t * capacity )
873```
874
875**Description**
876
877Obtains the capacity of the image receiver through an [ImageReceiverNative](#imagereceivernative) object.
878
879**Since**: 10
880
881**Parameters**
882
883| Name| Description| 
884| -------- | -------- |
885| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object. | 
886| capacity | Pointer to the capacity obtained. | 
887
888**Returns**
889
890For details, see [IRNdkErrCode](#irndkerrcode-1).
891
892Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
893
894Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
895
896Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
897
898Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
899
900Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
901
902
903**See**
904
905[ImageReceiverNative](#imagereceivernative), [OhosImageSize](_ohos_image_size.md)
906
907
908### OH_Image_Receiver_GetFormat()
909
910```
911int32_t OH_Image_Receiver_GetFormat (const ImageReceiverNative * native, int32_t * format )
912```
913
914**Description**
915
916Obtains the format of the image receiver through an [ImageReceiverNative](#imagereceivernative) object.
917
918**Since**: 10
919
920**Parameters**
921
922| Name| Description| 
923| -------- | -------- |
924| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object. | 
925| format | Pointer to the format obtained. | 
926
927**Returns**
928
929For details, see [IRNdkErrCode](#irndkerrcode-1).
930
931Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
932
933Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
934
935Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
936
937Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
938
939Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
940
941
942**See**
943
944[ImageReceiverNative](#imagereceivernative)
945
946
947### OH_Image_Receiver_GetReceivingSurfaceId()
948
949```
950int32_t OH_Image_Receiver_GetReceivingSurfaceId (const ImageReceiverNative * native, char * id, size_t len )
951```
952
953**Description**
954
955Obtains the receiver ID through an [ImageReceiverNative](#imagereceivernative) object.
956
957**Since**: 10
958
959**Parameters**
960
961| Name| Description| 
962| -------- | -------- |
963| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object. | 
964| id | Pointer to the buffer that stores the ID string obtained. | 
965| len | Size of the buffer. | 
966
967**Returns**
968
969For details, see [IRNdkErrCode](#irndkerrcode-1).
970
971Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
972
973Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
974
975Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
976
977Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
978
979Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
980
981Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
982
983Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
984
985Returns **IMAGE_RESULT_MEDIA_DATA_UNSUPPORT** if the media type is not supported.
986
987
988**See**
989
990[ImageReceiverNative](#imagereceivernative)
991
992
993### OH_Image_Receiver_GetSize()
994
995```
996int32_t OH_Image_Receiver_GetSize (const ImageReceiverNative * native, struct OhosImageSize * size )
997```
998
999**Description**
1000
1001Obtains the size of the image receiver through an [ImageReceiverNative](#imagereceivernative) object.
1002
1003**Since**: 10
1004
1005**Parameters**
1006
1007| Name| Description| 
1008| -------- | -------- |
1009| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object. | 
1010| size | Pointer to the [OhosImageSize](_ohos_image_size.md) object obtained. | 
1011
1012**Returns**
1013
1014For details, see [IRNdkErrCode](#irndkerrcode-1).
1015
1016Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1017
1018Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1019
1020Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1021
1022Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1023
1024Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1025
1026**See**
1027
1028[ImageReceiverNative](#imagereceivernative), [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback)
1029
1030
1031### OH_Image_Receiver_InitImageReceiverNative()
1032
1033```
1034ImageReceiverNative* OH_Image_Receiver_InitImageReceiverNative (napi_env env, napi_value source )
1035```
1036
1037**Description**
1038
1039Initializes an [ImageReceiverNative](#imagereceivernative) object through an **ImageReceiver** object.
1040
1041**Since**: 10
1042
1043**Parameters**
1044
1045| Name| Description| 
1046| -------- | -------- |
1047| env | Pointer to the NAPI environment. | 
1048| source | **ImageReceiver** object. | 
1049
1050**Returns**
1051
1052Returns a pointer to the [ImageReceiverNative](#imagereceivernative) object obtained if the operation is successful; returns a null pointer otherwise.
1053
1054**See**
1055
1056[ImageReceiverNative](#imagereceivernative), [OH_Image_Receiver_Release](#oh_image_receiver_release)
1057
1058
1059### OH_Image_Receiver_On()
1060
1061```
1062int32_t OH_Image_Receiver_On (const ImageReceiverNative * native, OH_Image_Receiver_On_Callback callback )
1063```
1064
1065**Description**
1066
1067Registers an [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback) callback. This callback is triggered whenever a new image is received.
1068
1069**Since**: 10
1070
1071**Parameters**
1072
1073| Name| Description| 
1074| -------- | -------- |
1075| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object. | 
1076| callback | [OH_Image_Receiver_On_Callback](#oh_image_receiver_on_callback) callback to register. | 
1077
1078**Returns**
1079
1080For details, see [IRNdkErrCode](#irndkerrcode-1).
1081
1082Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1083
1084Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1085
1086Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1087
1088Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid or a parameter fails to be obtained from the surface.
1089
1090Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
1091
1092Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1093
1094Returns **IMAGE_RESULT_REGISTER_LISTENER_FAILED** if the listener fails to be registered.
1095
1096Returns **IMAGE_RESULT_REGISTER_BUFFER_FAILED** if the buffer fails to be registered.
1097
1098
1099**See**
1100
1101[ImageReceiverNative](#imagereceivernative)
1102
1103
1104### OH_Image_Receiver_ReadLatestImage()
1105
1106```
1107int32_t OH_Image_Receiver_ReadLatestImage (const ImageReceiverNative * native, napi_value * image )
1108```
1109
1110**Description**
1111
1112Obtains the latest image through an [ImageReceiverNative](#imagereceivernative) object.
1113
1114**Since**: 10
1115
1116**Parameters**
1117
1118| Name| Description| 
1119| -------- | -------- |
1120| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object. | 
1121| image | Pointer to an **Image** object at the application layer. | 
1122
1123**Returns**
1124
1125For details, see [IRNdkErrCode](#irndkerrcode-1).
1126
1127Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1128
1129Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1130
1131Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1132
1133Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1134
1135Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
1136
1137Returns **IMAGE_RESULT_CREATE_SURFACE_FAILED** if the surface fails to be created.
1138
1139Returns **IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED** if the buffer fails to be allocated to the surface.
1140
1141Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
1142
1143Returns **IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT** if the media RTSP surface is not supported.
1144
1145Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1146
1147Returns **IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED** if the buffer fails to be requested.
1148
1149
1150**See**
1151
1152[ImageReceiverNative](#imagereceivernative)
1153
1154
1155### OH_Image_Receiver_ReadNextImage()
1156
1157```
1158int32_t OH_Image_Receiver_ReadNextImage (const ImageReceiverNative * native, napi_value * image )
1159```
1160
1161**Description**
1162
1163Obtains the next image through an [ImageReceiverNative](#imagereceivernative) object.
1164
1165**Since**: 10
1166
1167**Parameters**
1168
1169| Name| Description| 
1170| -------- | -------- |
1171| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object. | 
1172| image | Pointer to an **Image** object at the application layer. | 
1173
1174**Returns**
1175
1176For details, see [IRNdkErrCode](#irndkerrcode-1).
1177
1178Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1179
1180Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1181
1182Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1183
1184Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1185
1186Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
1187
1188Returns **IMAGE_RESULT_CREATE_SURFACE_FAILED** if the surface fails to be created.
1189
1190Returns **IMAGE_RESULT_SURFACE_GRALLOC_BUFFER_FAILED** if the buffer fails to be allocated to the surface.
1191
1192Returns **IMAGE_RESULT_GET_SURFACE_FAILED** if the surface fails to be obtained.
1193
1194Returns **IMAGE_RESULT_MEDIA_RTSP_SURFACE_UNSUPPORT** if the media RTSP surface is not supported.
1195
1196Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1197
1198Returns **IMAGE_RESULT_SURFACE_REQUEST_BUFFER_FAILED** if the buffer fails to be requested.
1199
1200**See**
1201
1202[ImageReceiverNative](#imagereceivernative)
1203
1204
1205### OH_Image_Receiver_Release()
1206
1207```
1208int32_t OH_Image_Receiver_Release (ImageReceiverNative * native)
1209```
1210
1211**Description**
1212
1213Releases an [ImageReceiverNative](#imagereceivernative) object. Note: This function is not used to release an **ImageReceiver** object.
1214
1215**Since**: 10
1216
1217**Parameters**
1218
1219| Name| Description| 
1220| -------- | -------- |
1221| native | Pointer to an [ImageReceiverNative](#imagereceivernative) object. | 
1222
1223**Returns**
1224
1225For details, see [IRNdkErrCode](#irndkerrcode-1).
1226
1227Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1228
1229Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1230
1231Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1232
1233Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1234
1235
1236**See**
1237
1238[ImageReceiverNative](#imagereceivernative)
1239
1240
1241### OH_Image_Release()
1242
1243```
1244int32_t OH_Image_Release (ImageNative * native)
1245```
1246
1247**Description**
1248
1249Releases an **ImageNative** object. Note: This function is not used to release an **Image** object at the JavaScript native API. It is used to release an **ImageNative** object parsed by calling **OH_Image_InitImageNative**.
1250
1251**Since**: 10
1252
1253**Parameters**
1254
1255| Name| Description| 
1256| -------- | -------- |
1257| native | Pointer to an **ImageNative** object. | 
1258
1259**Returns**
1260
1261For details, see [IRNdkErrCode](#irndkerrcode-1).
1262
1263Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1264
1265Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1266
1267Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1268
1269Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1270
1271**See**
1272
1273[ImageNative](image.md#imagenative), [OH_Image_InitImageNative](image.md#oh_image_initimagenative)
1274
1275
1276### OH_Image_Size()
1277
1278```
1279int32_t OH_Image_Size (const ImageNative * native, struct OhosImageSize * size )
1280```
1281
1282**Description**
1283
1284Obtains [OhosImageSize](_ohos_image_size.md) of an **ImageNative** object.
1285
1286**Since**: 10
1287
1288**Parameters**
1289
1290| Name| Description| 
1291| -------- | -------- |
1292| native | Pointer to an **ImageNative** object. | 
1293| size | Pointer to the [OhosImageSize](_ohos_image_size.md) object obtained. | 
1294
1295**Returns**
1296
1297For details, see [IRNdkErrCode](#irndkerrcode-1).
1298
1299Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1300
1301Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1302
1303Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1304
1305Returns **IMAGE_RESULT_SURFACE_GET_PARAMETER_FAILED** if parameters fail to be obtained from the surface.
1306
1307Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1308
1309**See**
1310
1311[ImageNative](image.md#imagenative), [OhosImageSize](_ohos_image_size.md)
1312
1313
1314### OH_ImagePacker_Create()
1315
1316```
1317int32_t OH_ImagePacker_Create (napi_env env, napi_value * res )
1318```
1319
1320**Description**
1321
1322Obtains an **ImagePacker** object at the JavaScript native layer.
1323
1324**Since**: 11
1325
1326**Parameters**
1327
1328| Name| Description| 
1329| -------- | -------- |
1330| env | Pointer to the JNI environment. | 
1331| res | Pointer to an **ImagePacker** object at the JavaScript native layer. | 
1332
1333**Returns**
1334
1335For details, see [IRNdkErrCode](#irndkerrcode-1).
1336
1337Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1338
1339Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1340
1341
1342### OH_ImagePacker_InitNative()
1343
1344```
1345ImagePacker_Native* OH_ImagePacker_InitNative (napi_env env, napi_value packer )
1346```
1347
1348**Description**
1349
1350Converts an **ImagePacker** object at the JavaScript native layer into an **ImagePacker_Native** object.
1351
1352**Since**: 11
1353
1354**Parameters**
1355
1356| Name| Description| 
1357| -------- | -------- |
1358| env | Pointer to the JNI environment. | 
1359| packer | **ImagePacker** object at the JavaScript native layer. | 
1360
1361**Returns**
1362
1363Returns the pointer to an [ImagePacker_Native](#imagepacker_native) object if the operation is successful; returns a null pointer otherwise.
1364
1365**See**
1366
1367[OH_ImagePacker_Release](#oh_imagepacker_release)
1368
1369
1370### OH_ImagePacker_PackToData()
1371
1372```
1373int32_t OH_ImagePacker_PackToData (ImagePacker_Native * native, napi_value source, ImagePacker_Opts * opts, uint8_t * outData, size_t * size )
1374```
1375
1376**Description**
1377
1378Packs a **PixelMap** object or an **ImagePacker** object at the JavaScript native layer to a buffer (defined by **outData**) based on the specified **ImagePacker_Opts** struct.
1379
1380**Since**: 11
1381
1382**Parameters**
1383
1384| Name| Description| 
1385| -------- | -------- |
1386| native | Pointer to an **ImagePacker_Native** object. | 
1387| source | **PixelMap** object or **ImageSource** object at the JavaScript native layer. | 
1388| opts | Pointer to the packing options. For details, see [ImagePacker_Opts](#imagepacker_opts). | 
1389| outData | Pointer to the output buffer. | 
1390| size | Pointer to the size of the buffer. | 
1391
1392**Returns**
1393
1394For details, see [IRNdkErrCode](#irndkerrcode-1).
1395
1396Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1397
1398Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1399
1400Returns **ERR_IMAGE_DATA_ABNORMAL** if the output buffer is abnormal.
1401
1402Returns **ERR_IMAGE_MISMATCHED_FORMAT** if the format does not match.
1403
1404Returns **ERR_IMAGE_MALLOC_ABNORMAL** if an internal error occurs during buffer memory allocation.
1405
1406Returns **ERR_IMAGE_DECODE_ABNORMAL** if an internal error occurs during codec initialization.
1407
1408Returns **ERR_IMAGE_ENCODE_FAILED** if an error occurs during encoding.
1409
1410**See**
1411
1412[OH_ImagePacker_PackToFile](#oh_imagepacker_packtofile)
1413
1414
1415### OH_ImagePacker_PackToFile()
1416
1417```
1418int32_t OH_ImagePacker_PackToFile (ImagePacker_Native * native, napi_value source, ImagePacker_Opts * opts, int fd )
1419```
1420
1421**Description**
1422
1423Packs a **PixelMap** object or an **ImagePacker** object at the JavaScript native layer to a file based on the specified **ImagePacker_Opts** struct.
1424
1425**Since**: 11
1426
1427**Parameters**
1428
1429| Name| Description| 
1430| -------- | -------- |
1431| native | Pointer to an **ImagePacker_Native** object. | 
1432| source | **PixelMap** object or **ImageSource** object at the JavaScript native layer. | 
1433| opts | Pointer to the packing options. For details, see [ImagePacker_Opts](#imagepacker_opts). | 
1434| fd | File descriptor of the output file. | 
1435
1436**Returns**
1437
1438For details, see [IRNdkErrCode](#irndkerrcode-1).
1439
1440Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1441
1442Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1443
1444Returns **ERR_IMAGE_DATA_ABNORMAL** if the output buffer is abnormal.
1445
1446Returns **ERR_IMAGE_MISMATCHED_FORMAT** if the format does not match.
1447
1448Returns **ERR_IMAGE_MALLOC_ABNORMAL** if an internal error occurs during buffer memory allocation.
1449
1450Returns **ERR_IMAGE_DECODE_ABNORMAL** if an internal error occurs during codec initialization.
1451
1452Returns **ERR_IMAGE_ENCODE_FAILED** if an error occurs during encoding.
1453
1454**See**
1455
1456[OH_ImagePacker_PackToData](#oh_imagepacker_packtodata)
1457
1458
1459### OH_ImagePacker_Release()
1460
1461```
1462int32_t OH_ImagePacker_Release (ImagePacker_Native * native)
1463```
1464
1465**Description**
1466
1467Releases an [ImagePacker_Native](#imagepacker_native) object,
1468
1469rather than the **ImagePacker** object at the JavaScript native layer.
1470
1471It is parsed by calling [OH_ImagePacker_InitNative](#oh_imagepacker_initnative).
1472
1473**Since**: 11
1474
1475**Parameters**
1476
1477| Name| Description| 
1478| -------- | -------- |
1479| native | Pointer to an [ImagePacker_Native](#imagepacker_native) object. | 
1480
1481**Returns**
1482
1483For details, see [IRNdkErrCode](#irndkerrcode-1).
1484
1485Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1486
1487**See**
1488
1489[OH_ImagePacker_InitNative](#oh_imagepacker_initnative)
1490
1491
1492
1493### OH_ImageSource_Create()
1494
1495```
1496int32_t OH_ImageSource_Create (napi_env env, struct OhosImageSource * src, struct OhosImageSourceOps * ops, napi_value * res )
1497```
1498
1499**Description**
1500
1501Creates an **ImageSource** object at the JavaScript native layer based on the specified [OhosImageSource](_ohos_image_source.md) and [OhosImageSourceOps](_ohos_image_source_ops.md) structs.
1502
1503**Since**: 10
1504
1505**Deprecated from**: 11
1506
1507**Substitute**: [OH_ImageSource_CreateFromUri](#oh_imagesource_createfromuri), [OH_ImageSource_CreateFromFd](#oh_imagesource_createfromfd), and [OH_ImageSource_CreateFromData](#oh_imagesource_createfromdata)
1508
1509**Parameters**
1510
1511| Name| Description| 
1512| -------- | -------- |
1513| env | Pointer to the JNI environment. | 
1514| src | Pointer to the input resource of the image source. For details, see [OhosImageSource](_ohos_image_source.md). | 
1515| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md). | 
1516| res | Pointer to an **ImageSource** object at the JavaScript native layer. | 
1517
1518**Returns**
1519
1520For details, see [IRNdkErrCode](#irndkerrcode-1).
1521
1522Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1523
1524Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1525
1526Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1527
1528Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1529
1530Returns **IMAGE_RESULT_SOURCE_DATA_INCOMPLETE** if the image source data is incomplete.
1531
1532Returns **IMAGE_RESULT_SOURCE_DATA** if the image source data is incorrect.
1533
1534Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
1535
1536Returns **IMAGE_RESULT_TOO_LARGE** if the image is too large.
1537
1538Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
1539
1540Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
1541
1542Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
1543
1544Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
1545
1546Returns **IMAGE_RESULT_FILE_DAMAGED** if the file is damaged.
1547
1548Returns **IMAGE_RESULT_FILE_FD_ERROR** if the file descriptor is incorrect.
1549
1550Returns **IMAGE_RESULT_STREAM_SIZE_ERROR** if the data stream is incorrect.
1551
1552Returns **IMAGE_RESULT_SEEK_FAILED** if seeking the file fails.
1553
1554Returns **IMAGE_RESULT_PEEK_FAILED** if peeking the file fails.
1555
1556Returns **IMAGE_RESULT_FREAD_FAILED** if reading the file fails.
1557
1558**See**
1559
1560[OhosImageSource](_ohos_image_source.md), [OhosImageSourceOps](_ohos_image_source_ops.md)
1561
1562
1563
1564### OH_ImageSource_CreateFromData()
1565
1566```
1567int32_t OH_ImageSource_CreateFromData (napi_env env, uint8_t * data, size_t dataSize, struct OhosImageSourceOps * ops, napi_value * res )
1568```
1569
1570**Description**
1571
1572Creates an **ImageSource** object at the JavaScript native layer based on the specified image source buffer resource (defined by **data**) and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.
1573
1574**Since**: 11
1575
1576**Parameters**
1577
1578| Name| Description| 
1579| -------- | -------- |
1580| env | Pointer to the JNI environment. | 
1581| data | Pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted. | 
1582| dataSize | Size of the image source buffer. | 
1583| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md). | 
1584| res | Pointer to an **ImageSource** object at the JavaScript native layer. | 
1585
1586**Returns**
1587
1588For details, see [IRNdkErrCode](#irndkerrcode-1).
1589
1590Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1591
1592Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1593
1594Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1595
1596Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1597
1598**See**
1599
1600[OhosImageSourceOps](_ohos_image_source_ops.md)
1601
1602
1603### OH_ImageSource_CreateFromFd()
1604
1605```
1606int32_t OH_ImageSource_CreateFromFd (napi_env env, int32_t fd, struct OhosImageSourceOps * ops, napi_value * res )
1607```
1608
1609**Description**
1610
1611Creates an **ImageSource** object at the JavaScript native layer based on the specified file descriptor and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.
1612
1613**Since**: 11
1614
1615**Parameters**
1616
1617| Name| Description| 
1618| -------- | -------- |
1619| env | Pointer to the JNI environment. | 
1620| fd | Descriptor of the image source. | 
1621| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md). | 
1622| res | Pointer to an **ImageSource** object at the JavaScript native layer. | 
1623
1624**Returns**
1625
1626For details, see [IRNdkErrCode](#irndkerrcode-1).
1627
1628Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1629
1630Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1631
1632Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1633
1634Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1635
1636**See**
1637
1638[OhosImageSourceOps](_ohos_image_source_ops.md)
1639
1640
1641### OH_ImageSource_CreateFromRawFile()
1642
1643```
1644int32_t OH_ImageSource_CreateFromRawFile (napi_env env, RawFileDescriptor rawFile, struct OhosImageSourceOps * ops, napi_value * res )
1645```
1646
1647**Description**
1648
1649Creates an **ImageSource** object at the JavaScript native layer based on the specified raw file descriptor and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.
1650
1651**Since**: 11
1652
1653**Parameters**
1654
1655| Name| Description| 
1656| -------- | -------- |
1657| env | Pointer to the JNI environment. | 
1658| rawFile | Descriptor of the image source resource. | 
1659| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md). | 
1660| res | Pointer to an **ImageSource** object at the JavaScript native layer. | 
1661
1662**Returns**
1663
1664For details, see [IRNdkErrCode](#irndkerrcode-1).
1665
1666Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1667
1668Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1669
1670Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1671
1672Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1673
1674**See**
1675
1676[OhosImageSourceOps](_ohos_image_source_ops.md)
1677
1678
1679### OH_ImageSource_CreateFromUri()
1680
1681```
1682int32_t OH_ImageSource_CreateFromUri (napi_env env, char * uri, size_t size, struct OhosImageSourceOps * ops, napi_value * res )
1683```
1684
1685**Description**
1686
1687Creates an **ImageSource** object at the JavaScript native layer based on the specified URI and [OhosImageSourceOps](_ohos_image_source_ops.md) struct.
1688
1689**Since**: 11
1690
1691**Parameters**
1692
1693| Name| Description| 
1694| -------- | -------- |
1695| env | Pointer to the JNI environment. | 
1696| uri | Pointer to the image source URI. Only a file URI or Base64 URI is accepted. Currently, only absolute paths are supported. |
1697| size | Length of the image source URI. | 
1698| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md). | 
1699| res | Pointer to an **ImageSource** object at the JavaScript native layer. | 
1700
1701**Returns**
1702
1703For details, see [IRNdkErrCode](#irndkerrcode-1).
1704
1705Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1706
1707Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1708
1709Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1710
1711Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1712
1713**See**
1714
1715[OhosImageSourceOps](_ohos_image_source_ops.md)
1716
1717
1718### OH_ImageSource_CreateIncremental()
1719
1720```
1721int32_t OH_ImageSource_CreateIncremental (napi_env env, struct OhosImageSource * source, struct OhosImageSourceOps * ops, napi_value * res )
1722```
1723
1724**Description**
1725
1726Creates an **ImageSource** object at the JavaScript native layer based on the specified [OhosImageSource](_ohos_image_source.md) and [OhosImageSourceOps](_ohos_image_source_ops.md) structs. The image source data will be updated through **OH_ImageSource_UpdateData**.
1727
1728**Since**: 10
1729
1730
1731**Deprecated from**: 11
1732
1733**Substitute**: [OH_ImageSource_CreateIncrementalFromData](#oh_imagesource_createincrementalfromdata)
1734
1735**Parameters**
1736
1737| Name| Description| 
1738| -------- | -------- |
1739| env | Pointer to the JNI environment. | 
1740| src | Pointer to the input resource of the image source. Only the buffer type is accepted. For details, see [OhosImageSource](_ohos_image_source.md). | 
1741| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md). | 
1742| res | Pointer to an **ImageSource** object at the JavaScript native layer. | 
1743
1744**Returns**
1745
1746For details, see [IRNdkErrCode](#irndkerrcode-1).
1747
1748Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1749
1750Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1751
1752Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1753
1754Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1755
1756Returns **IMAGE_RESULT_SOURCE_DATA_INCOMPLETE** if the image source data is incomplete.
1757
1758Returns **IMAGE_RESULT_SOURCE_DATA** if the image source data is incorrect.
1759
1760Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
1761
1762Returns **IMAGE_RESULT_TOO_LARGE** if the image is too large.
1763
1764Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
1765
1766Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
1767
1768Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
1769
1770Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
1771
1772Returns **IMAGE_RESULT_FILE_DAMAGED** if the file is damaged.
1773
1774Returns **IMAGE_RESULT_FILE_FD_ERROR** if the file descriptor is incorrect.
1775
1776Returns **IMAGE_RESULT_STREAM_SIZE_ERROR** if the data stream is incorrect.
1777
1778Returns **IMAGE_RESULT_SEEK_FAILED** if seeking the file fails.
1779
1780Returns **IMAGE_RESULT_PEEK_FAILED** if peeking the file fails.
1781
1782Returns **IMAGE_RESULT_FREAD_FAILED** if reading the file fails.
1783
1784**See**
1785
1786[OhosImageSource](_ohos_image_source.md), [OhosImageSourceOps](_ohos_image_source_ops.md), [OH_ImageSource_UpdateData](#oh_imagesource_updatedata)
1787
1788
1789### OH_ImageSource_CreateIncrementalFromData()
1790
1791```
1792int32_t OH_ImageSource_CreateIncrementalFromData (napi_env env, uint8_t * data, size_t dataSize, struct OhosImageSourceOps * ops, napi_value * res )
1793```
1794
1795**Description**
1796
1797Creates an **ImageSource** object of the incremental type at the JavaScript native layer based on the specified image source buffer resource (defined by **data**) and [OhosImageSourceOps](_ohos_image_source_ops.md) struct. The image data is updated through **OH_ImageSource_UpdateData**. 
1798
1799**Since**: 11
1800
1801**Parameters**
1802
1803| Name| Description| 
1804| -------- | -------- |
1805| env | Pointer to the JNI environment. | 
1806| data | Pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted. | 
1807| dataSize | Size of the image source buffer. | 
1808| ops | Pointer to the options for creating the image source. For details, see [OhosImageSourceOps](_ohos_image_source_ops.md). | 
1809| res | Pointer to an **ImageSource** object at the JavaScript native layer. | 
1810
1811**Returns**
1812
1813For details, see [IRNdkErrCode](#irndkerrcode-1).
1814
1815Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1816
1817Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1818
1819Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1820
1821Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1822
1823**See**
1824
1825[OhosImageSourceOps](_ohos_image_source_ops.md)
1826
1827
1828### OH_ImageSource_CreatePixelMap()
1829
1830```
1831int32_t OH_ImageSource_CreatePixelMap (const ImageSourceNative * native, struct OhosImageDecodingOps * ops, napi_value * res )
1832```
1833
1834**Description**
1835
1836Decodes an **ImageSourceNative** object to obtain a **PixelMap** object at the JavaScript native layer based on the specified [OhosImageDecodingOps](_ohos_image_decoding_ops.md) struct.
1837
1838**Since**: 10
1839
1840**Parameters**
1841
1842| Name| Description| 
1843| -------- | -------- |
1844| native | Pointer to an [ImageSourceNative](#imagesourcenative) object. | 
1845| ops | Pointer to the options for decoding the image source. For details, see [OhosImageDecodingOps](_ohos_image_decoding_ops.md). | 
1846| res | Pointer to a **PixelMap** object at the JavaScript native layer. | 
1847
1848**Returns**
1849
1850For details, see [IRNdkErrCode](#irndkerrcode-1).
1851
1852Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
1853
1854Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1855
1856Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1857
1858Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1859
1860Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
1861
1862Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
1863
1864Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
1865
1866Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
1867
1868Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
1869
1870Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
1871
1872Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
1873
1874Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
1875
1876Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
1877
1878Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
1879
1880Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
1881
1882Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
1883
1884Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1885
1886Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
1887
1888Returns **IMAGE_RESULT_CROP** if cropping fails.
1889
1890Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
1891
1892Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
1893
1894Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
1895
1896Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
1897
1898Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
1899
1900Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
1901
1902Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
1903
1904Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
1905
1906Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
1907
1908Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
1909
1910**See**
1911
1912[ImageSourceNative](#imagesourcenative), [OhosImageDecodingOps](_ohos_image_decoding_ops.md)
1913
1914
1915### OH_ImageSource_CreatePixelMapList()
1916
1917```
1918int32_t OH_ImageSource_CreatePixelMapList (const ImageSourceNative * native, struct OhosImageDecodingOps * ops, napi_value * res )
1919```
1920
1921**Description**
1922
1923Decodes an **ImageSourceNative** object to obtain all **PixelMap** objects at the JavaScript native layer based on the specified [OhosImageDecodingOps](_ohos_image_decoding_ops.md) struct.
1924
1925
1926**Since**: 10
1927
1928**Parameters**
1929
1930| Name| Description| 
1931| -------- | -------- |
1932| native | Pointer to an [ImageSourceNative](#imagesourcenative) object. | 
1933| ops | Pointer to the options for decoding the image source. For details, see [OhosImageDecodingOps](_ohos_image_decoding_ops.md). | 
1934| res | Pointer to **PixelMap** objects at the JavaScript native layer. | 
1935
1936**Returns**
1937
1938For details, see [IRNdkErrCode](#irndkerrcode-1).
1939
1940Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
1941
1942Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
1943
1944Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
1945
1946Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
1947
1948Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
1949
1950Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
1951
1952Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
1953
1954Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
1955
1956Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
1957
1958Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
1959
1960Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
1961
1962Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
1963
1964Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
1965
1966Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
1967
1968Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
1969
1970Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
1971
1972Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
1973
1974Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
1975
1976Returns **IMAGE_RESULT_CROP** if cropping fails.
1977
1978Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
1979
1980Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
1981
1982Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
1983
1984Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
1985
1986Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
1987
1988Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
1989
1990Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
1991
1992Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
1993
1994Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
1995
1996Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
1997
1998Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
1999
2000Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2001
2002**See**
2003
2004[ImageSourceNative](#imagesourcenative), [OhosImageDecodingOps](_ohos_image_decoding_ops.md)
2005
2006
2007### OH_ImageSource_GetDelayTime()
2008
2009```
2010int32_t OH_ImageSource_GetDelayTime (const ImageSourceNative * native, struct OhosImageSourceDelayTimeList * res )
2011```
2012
2013**Description**
2014
2015Obtains the delay time list from an **ImageSourceNative** object (such as GIF image source).
2016
2017**Since**: 10
2018
2019**Parameters**
2020
2021| Name| Description| 
2022| -------- | -------- |
2023| native | Pointer to an [ImageSourceNative](#imagesourcenative) object. | 
2024| res | Pointer to the [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md) object obtained. When the input **delayTimeList** is a null pointer and **size** is **0**, the size of the delay time list is returned through **size** in **res**. To obtain the complete delay time list, a space greater than **size** is required. | 
2025
2026**Returns**
2027
2028For details, see [IRNdkErrCode](#irndkerrcode-1).
2029
2030Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2031
2032Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2033
2034Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2035
2036Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2037
2038Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2039
2040Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2041
2042Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2043
2044Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2045
2046Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2047
2048Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2049
2050Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2051
2052Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2053
2054Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2055
2056Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2057
2058Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2059
2060Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2061
2062Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2063
2064Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2065
2066**See**
2067
2068[ImageSourceNative](#imagesourcenative), [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md)
2069
2070
2071### OH_ImageSource_GetFrameCount()
2072
2073```
2074int32_t OH_ImageSource_GetFrameCount (const ImageSourceNative * native, uint32_t * res )
2075```
2076
2077**Description**
2078
2079Obtains the number of frames from an **ImageSourceNative** object.
2080
2081**Since**: 10
2082
2083**Parameters**
2084
2085| Name| Description| 
2086| -------- | -------- |
2087| native | Pointer to an [ImageSourceNative](#imagesourcenative) object. | 
2088| res | Pointer to the frame count. | 
2089
2090**Returns**
2091
2092For details, see [IRNdkErrCode](#irndkerrcode-1).
2093
2094Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2095
2096Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2097
2098Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2099
2100Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2101
2102Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2103
2104Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2105
2106Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2107
2108Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2109
2110Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2111
2112Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2113
2114Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2115
2116Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2117
2118Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2119
2120Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2121
2122Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2123
2124Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2125
2126Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2127
2128Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2129
2130**See**
2131
2132[ImageSourceNative](#imagesourcenative)
2133
2134
2135### OH_ImageSource_GetImageInfo()
2136
2137```
2138int32_t OH_ImageSource_GetImageInfo (const ImageSourceNative * native, int32_t index, struct OhosImageSourceInfo * info )
2139```
2140
2141**Description**
2142
2143Obtains image source information from an **ImageSourceNative** object by index.
2144
2145**Since**: 10
2146
2147**Parameters**
2148
2149| Name| Description| 
2150| -------- | -------- |
2151| native | Pointer to an [ImageSourceNative](#imagesourcenative) object. | 
2152| index | Index. | 
2153| info | Pointer to the [OhosImageSourceInfo](_ohos_image_source_info.md) object obtained. | 
2154
2155**Returns**
2156
2157For details, see [IRNdkErrCode](#irndkerrcode-1).
2158
2159Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2160
2161Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2162
2163Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2164
2165Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2166
2167Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2168
2169Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2170
2171Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2172
2173Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2174
2175Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2176
2177Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2178
2179Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2180
2181Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2182
2183Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2184
2185Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2186
2187Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2188
2189Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2190
2191Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2192
2193Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2194
2195
2196**See**
2197
2198[ImageSourceNative](#imagesourcenative), [OhosImageSourceInfo](_ohos_image_source_info.md)
2199
2200
2201### OH_ImageSource_GetImageProperty()
2202
2203```
2204int32_t OH_ImageSource_GetImageProperty (const ImageSourceNative * native, struct OhosImageSourceProperty * key, struct OhosImageSourceProperty * value )
2205```
2206
2207**Description**
2208
2209Obtains the value of an image property from an **ImageSourceNative** object.
2210
2211**Since**: 10
2212
2213**Parameters**
2214
2215| Name| Description| 
2216| -------- | -------- |
2217| native | Pointer to an [ImageSourceNative](#imagesourcenative) object. | 
2218| key | Pointer to the property. For details, see [OhosImageSourceProperty](_ohos_image_source_property.md). | 
2219| value | Pointer to the [OhosImageSourceProperty](_ohos_image_source_property.md) object obtained. If the input **value** is a null pointer and **size** is **0**, the size of the property value is returned through **size** in **value**. To obtain the complete property value, a space greater than **size** is required. | 
2220
2221**Returns**
2222
2223For details, see [IRNdkErrCode](#irndkerrcode-1).
2224
2225Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2226
2227Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2228
2229Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2230
2231Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2232
2233Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2234
2235Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2236
2237Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2238
2239Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2240
2241Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2242
2243Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2244
2245Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2246
2247Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2248
2249Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2250
2251Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2252
2253Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2254
2255Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2256
2257Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2258
2259Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2260
2261**See**
2262
2263[ImageSourceNative](#imagesourcenative), [OhosImageSourceProperty](_ohos_image_source_property.md)
2264
2265
2266### OH_ImageSource_GetSupportedFormats()
2267
2268```
2269int32_t OH_ImageSource_GetSupportedFormats (struct OhosImageSourceSupportedFormatList * res)
2270```
2271
2272**Description**
2273
2274Obtains all supported decoding formats.
2275
2276**Since**: 10
2277
2278**Parameters**
2279
2280| Name| Description| 
2281| -------- | -------- |
2282| res | Pointer to the [OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md) struct. If the input **supportedFormatList** is a null pointer and **size** is 0, the size of the supported formats is returned through **size** in **res**.<br>To obtain all formats, a space larger than **size** is required. In addition, sufficient space must be reserved for each format supported.| 
2283
2284**Returns**
2285
2286For details, see [IRNdkErrCode](#irndkerrcode-1).
2287
2288Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2289
2290Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2291
2292Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2293
2294Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2295
2296Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2297
2298Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2299
2300**See**
2301
2302[OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md), [OhosImageSourceSupportedFormat](_ohos_image_source_supported_format.md)
2303
2304
2305### OH_ImageSource_InitNative()
2306
2307```
2308ImageSourceNative* OH_ImageSource_InitNative (napi_env env, napi_value source )
2309```
2310
2311**Description**
2312
2313Converts an **ImageSource** object at the JavaScript native layer into an [ImageSourceNative](#imagesourcenative) object.
2314
2315**Since**: 10
2316
2317**Parameters**
2318
2319| Name| Description| 
2320| -------- | -------- |
2321| env | Pointer to the JNI environment. | 
2322| source | Pointer to an **ImageSource** object at the JavaScript native layer. | 
2323
2324**Returns**
2325
2326Returns a pointer to the [ImageSourceNative](#imagesourcenative) object if the operation is successful; returns a null pointer otherwise.
2327
2328**See**
2329
2330[ImageSourceNative](#imagesourcenative), [OH_ImageSource_Release](#oh_imagesource_release)
2331
2332
2333### OH_ImageSource_ModifyImageProperty()
2334
2335```
2336int32_t OH_ImageSource_ModifyImageProperty (const ImageSourceNative * native, struct OhosImageSourceProperty * key, struct OhosImageSourceProperty * value )
2337```
2338
2339**Description**
2340
2341Modifies the value of an image property of an **ImageSourceNative** object.
2342
2343**Since**: 10
2344
2345**Parameters**
2346
2347| Name| Description| 
2348| -------- | -------- |
2349| native | Pointer to an [ImageSourceNative](#imagesourcenative) object. | 
2350| key | Pointer to the property. For details, see [OhosImageSourceProperty](_ohos_image_source_property.md). | 
2351| value | Pointer to the new value of the property. | 
2352
2353**Returns**
2354
2355For details, see [IRNdkErrCode](#irndkerrcode-1).
2356
2357Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2358
2359Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2360
2361Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2362
2363Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2364
2365Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2366
2367Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2368
2369Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2370
2371Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2372
2373Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2374
2375Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2376
2377Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2378
2379Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2380
2381Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2382
2383Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2384
2385Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2386
2387Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2388
2389Returns **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT** if EXIF is not supported for image decoding.
2390
2391Returns **IMAGE_RESULT_PROPERTY_NOT_EXIST** if the image property does not exist.
2392
2393**See**
2394
2395[ImageSourceNative](#imagesourcenative), [OhosImageSourceProperty](_ohos_image_source_property.md)
2396
2397
2398### OH_ImageSource_Release()
2399
2400```
2401int32_t OH_ImageSource_Release (ImageSourceNative * native)
2402```
2403
2404**Description**
2405
2406Releases an **ImageSourceNative** object.
2407
2408**Since**: 10
2409
2410**Parameters**
2411
2412| Name| Description| 
2413| -------- | -------- |
2414| native | Pointer to an [ImageSourceNative](#imagesourcenative) object. | 
2415
2416**Returns**
2417
2418For details, see [IRNdkErrCode](#irndkerrcode-1).
2419
2420Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2421
2422Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2423
2424Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2425
2426Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2427
2428Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2429
2430Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2431
2432**See**
2433
2434[ImageSourceNative](#imagesourcenative), [OH_ImageSource_Create](#oh_imagesource_create), [OH_ImageSource_CreateIncremental](#oh_imagesource_createincremental)
2435
2436
2437### OH_ImageSource_UpdateData()
2438
2439```
2440int32_t OH_ImageSource_UpdateData (const ImageSourceNative * native, struct OhosImageSourceUpdateData * data )
2441```
2442
2443**Description**
2444
2445Updates the data of an **ImageSourceNative** object.
2446
2447**Since**: 10
2448
2449**Parameters**
2450
2451| Name| Description| 
2452| -------- | -------- |
2453| native | Pointer to an [ImageSourceNative](#imagesourcenative) object. | 
2454| data | Pointer to the update data. For details, see [OhosImageSourceUpdateData](_ohos_image_source_update_data.md). | 
2455
2456**Returns**
2457
2458
2459Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful.
2460
2461Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2462
2463Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2464
2465Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2466
2467Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2468
2469Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2470
2471Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2472
2473Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2474
2475Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
2476
2477Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2478
2479Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2480
2481Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2482
2483Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2484
2485Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2486
2487Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2488
2489Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2490
2491Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the image type is not supported.
2492
2493Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
2494
2495Returns **IMAGE_RESULT_CROP** if cropping fails.
2496
2497Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2498
2499Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2500
2501Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2502
2503Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
2504
2505Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
2506
2507Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
2508
2509Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
2510
2511Returns **IMAGE_RESULT_INDEX_INVALID** if the index is invalid.
2512
2513Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2514
2515Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2516
2517
2518**See**
2519
2520[ImageSourceNative](#imagesourcenative), [OhosImageSourceUpdateData](_ohos_image_source_update_data.md)
2521
2522
2523### OH_PixelMap_AccessPixels()
2524
2525```
2526int32_t OH_PixelMap_AccessPixels (const NativePixelMap * native, void ** addr )
2527```
2528
2529**Description**
2530
2531Obtains the memory address of a **NativePixelMap** object and locks the memory.
2532
2533**Since**: 10
2534
2535**Parameters**
2536
2537| Name| Description| 
2538| -------- | -------- |
2539| native | Pointer to a **NativePixelMap** object. | 
2540| addr | Double pointer to the memory address. | 
2541
2542**Returns**
2543
2544For details, see [IRNdkErrCode](#irndkerrcode-1).
2545
2546Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2547
2548Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2549
2550Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2551
2552Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2553
2554Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2555
2556Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2557
2558Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2559
2560Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2561
2562Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2563
2564Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2565
2566Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2567
2568Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2569
2570Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2571
2572Returns **IMAGE_RESULT_CROP** if cropping fails.
2573
2574Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2575
2576Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2577
2578Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2579
2580Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2581
2582Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2583
2584Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2585
2586
2587
2588
2589### OH_PixelMap_CreateAlphaPixelMap()
2590
2591```
2592int32_t OH_PixelMap_CreateAlphaPixelMap (napi_env env, napi_value source, napi_value * alpha )
2593```
2594
2595**Description**
2596
2597Creates a **PixelMap** object that contains only alpha channel information.
2598
2599**Since**: 10
2600
2601**Parameters**
2602
2603| Name| Description| 
2604| -------- | -------- |
2605| env | Pointer to the NAPI environment. | 
2606| source | Options for setting the **PixelMap** object. | 
2607| alpha | Pointer to the alpha channel. | 
2608
2609**Returns**
2610
2611For details, see [IRNdkErrCode](#irndkerrcode-1).
2612
2613Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2614
2615Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2616
2617Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2618
2619Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2620
2621Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2622
2623Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2624
2625Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2626
2627Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2628
2629Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
2630
2631Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2632
2633Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2634
2635Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2636
2637Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2638
2639Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2640
2641Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2642
2643Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2644
2645Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2646
2647Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
2648
2649Returns **IMAGE_RESULT_CROP** if cropping fails.
2650
2651Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2652
2653Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2654
2655Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2656
2657Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
2658
2659Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
2660
2661Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
2662
2663Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
2664
2665Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2666
2667Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2668
2669Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2670
2671
2672### OH_PixelMap_CreatePixelMap()
2673
2674```
2675int32_t OH_PixelMap_CreatePixelMap (napi_env env, OhosPixelMapCreateOps info, void * buf, size_t len, napi_value * res )
2676```
2677
2678**Description**
2679
2680Creates a **PixelMap** object. Currently, only BGRA input streams are supported. The buffer passed in by this API does not support the stride.
2681
2682**Since**: 10
2683
2684**Parameters**
2685
2686| Name| Description| 
2687| -------- | -------- |
2688| env | Pointer to the NAPI environment. | 
2689| info |Options for setting the **PixelMap** object. | 
2690| buf | Pointer to the buffer of the image. | 
2691| len | Image size. | 
2692| res | Pointer to the **PixelMap** object at the application layer. | 
2693
2694**Returns**
2695
2696For details, see [IRNdkErrCode](#irndkerrcode-1).
2697
2698Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2699
2700Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2701
2702Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2703
2704Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2705
2706Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2707
2708Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2709
2710Returns **IMAGE_RESULT_DECODE_HEAD_ABNORMAL** if an error occurs during decoding of the image header.
2711
2712Returns **IMAGE_RESULT_CREATE_DECODER_FAILED** if the decoder fails to be created.
2713
2714Returns **IMAGE_RESULT_CREATE_ENCODER_FAILED** if the encoder fails to be created.
2715
2716Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2717
2718Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2719
2720Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2721
2722Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2723
2724Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2725
2726Returns **IMAGE_RESULT_DECODE_ABNORMAL** if image decoding fails.
2727
2728Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2729
2730Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2731
2732Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
2733
2734Returns **IMAGE_RESULT_CROP** if cropping fails.
2735
2736Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2737
2738Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2739
2740Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2741
2742Returns **IMAGE_RESULT_ENCODE_FAILED** if the image fails to be encoded.
2743
2744Returns **IMAGE_RESULT_HW_DECODE_UNSUPPORT** if hardware decoding is not supported.
2745
2746Returns **IMAGE_RESULT_HW_DECODE_FAILED** if hardware decoding fails.
2747
2748Returns **IMAGE_RESULT_ERR_IPC** if IPC fails.
2749
2750Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2751
2752Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2753
2754Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2755
2756
2757
2758### OH_PixelMap_CreatePixelMapWithStride()
2759
2760```
2761int32_t OH_PixelMap_CreatePixelMapWithStride (napi_env env, OhosPixelMapCreateOps info, void * buf, size_t len, int32_t rowStride, napi_value * res )
2762```
2763
2764**Description**
2765
2766Creates a **PixelMap** object. Currently, only BGRA input streams are supported. For a pixel map in RGBA format (with the size greater than 512\*512), DMA memory is used by default.
2767
2768**Since**: 12
2769
2770**Parameters**
2771
2772| Name| Description| 
2773| -------- | -------- |
2774| env | Pointer to the NAPI environment. | 
2775| info | Options for setting the **PixelMap** object. | 
2776| buf | Pointer to the buffer of the image. | 
2777| len | Buffer size. | 
2778| rowStride | Row stride. The stride is the actual memory size occupied by each row of the image, in bytes. Stride = Width \*Number of bytes per pixel + Padding, where padding refers to the extra space added at the end of each row for memory alignment purposes. | 
2779| res | Pointer to the **PixelMap** object at the application layer. | 
2780
2781**Returns**
2782
2783For details, see [IRNdkErrCode](#irndkerrcode-1).
2784
2785Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2786
2787Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2788
2789Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2790
2791Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2792
2793Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2794
2795Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2796
2797Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2798
2799Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2800
2801Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2802
2803
2804
2805### OH_PixelMap_Crop()
2806
2807```
2808int32_t OH_PixelMap_Crop (const NativePixelMap * native, int32_t x, int32_t y, int32_t width, int32_t height )
2809```
2810
2811**Description**
2812
2813Crops a **NativePixelMap** object.
2814
2815**Since**: 10
2816
2817**Parameters**
2818
2819| Name| Description| 
2820| -------- | -------- |
2821| native | Pointer to a **NativePixelMap** object. | 
2822| x | X-coordinate of the upper left corner of the target image. | 
2823| y | Y-coordinate of the upper left corner of the target image. | 
2824| width | Width of the cropped region. | 
2825| height | Height of the cropped region. | 
2826
2827**Returns**
2828
2829For details, see [IRNdkErrCode](#irndkerrcode-1).
2830
2831Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2832
2833Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2834
2835Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2836
2837Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2838
2839Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2840
2841Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2842
2843Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2844
2845Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2846
2847Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2848
2849Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2850
2851Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2852
2853Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2854
2855Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2856
2857Returns **IMAGE_RESULT_CROP** if cropping fails.
2858
2859Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2860
2861Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2862
2863Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2864
2865Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2866
2867Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2868
2869Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2870
2871
2872
2873
2874### OH_PixelMap_Flip()
2875
2876```
2877int32_t OH_PixelMap_Flip (const NativePixelMap * native, int32_t x, int32_t y )
2878```
2879
2880**Description**
2881
2882Flips a **NativePixelMap** object.
2883
2884**Since**: 10
2885
2886**Parameters**
2887
2888| Name| Description| 
2889| -------- | -------- |
2890| native | Pointer to a **NativePixelMap** object. | 
2891| x | Whether to flip around the x axis. | 
2892| y | Whether to flip around the y axis. | 
2893
2894**Returns**
2895
2896For details, see [IRNdkErrCode](#irndkerrcode-1).
2897
2898Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2899
2900Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2901
2902Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2903
2904Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2905
2906Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
2907
2908Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
2909
2910Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
2911
2912Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
2913
2914Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2915
2916Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
2917
2918Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
2919
2920Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
2921
2922Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
2923
2924Returns **IMAGE_RESULT_CROP** if cropping fails.
2925
2926Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
2927
2928Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
2929
2930Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
2931
2932Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2933
2934Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
2935
2936Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
2937
2938
2939
2940### OH_PixelMap_GetBytesNumberPerRow()
2941
2942```
2943int32_t OH_PixelMap_GetBytesNumberPerRow (const NativePixelMap * native, int32_t * num )
2944```
2945
2946**Description**
2947
2948Obtains the number of bytes per row of a **NativePixelMap** object.
2949
2950**Since**: 10
2951
2952**Parameters**
2953
2954| Name| Description| 
2955| -------- | -------- |
2956| native | Pointer to a **NativePixelMap** object. | 
2957| num | Pointer to the number of bytes per row. | 
2958
2959**Returns**
2960
2961For details, see [IRNdkErrCode](#irndkerrcode-1).
2962
2963Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
2964
2965Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
2966
2967Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
2968
2969Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
2970
2971Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
2972
2973Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
2974
2975
2976
2977
2978### OH_PixelMap_GetDensity()
2979
2980```
2981int32_t OH_PixelMap_GetDensity (const NativePixelMap * native, int32_t * density )
2982```
2983
2984**Description**
2985
2986Obtains the pixel density of a **NativePixelMap** object.
2987
2988**Since**: 10
2989
2990**Parameters**
2991
2992| Name| Description| 
2993| -------- | -------- |
2994| native | Pointer to a **NativePixelMap** object. | 
2995| density | Pointer to the pixel density. | 
2996
2997**Returns**
2998
2999For details, see [IRNdkErrCode](#irndkerrcode-1).
3000
3001Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3002
3003Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3004
3005Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3006
3007Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3008
3009Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3010
3011Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3012
3013
3014
3015
3016### OH_PixelMap_GetImageInfo()
3017
3018```
3019int32_t OH_PixelMap_GetImageInfo (const NativePixelMap * native, OhosPixelMapInfos * info )
3020```
3021
3022**Description**
3023
3024Obtains the image information of a **NativePixelMap** object.
3025
3026**Since**: 10
3027
3028**Parameters**
3029
3030| Name| Description| 
3031| -------- | -------- |
3032| native | Pointer to a **NativePixelMap** object. | 
3033| info | Pointer to the image information. | 
3034
3035**Returns**
3036
3037For details, see [IRNdkErrCode](#irndkerrcode-1).
3038
3039Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3040
3041Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3042
3043Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3044
3045Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3046
3047Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3048
3049Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3050
3051Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3052
3053Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3054
3055Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3056
3057Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3058
3059Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3060
3061Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3062
3063Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3064
3065Returns **IMAGE_RESULT_CROP** if cropping fails.
3066
3067Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3068
3069Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3070
3071Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3072
3073Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3074
3075Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3076
3077Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3078
3079**See**
3080
3081[OhosPixelMapInfos](_ohos_pixel_map_infos.md)
3082
3083
3084### OH_PixelMap_GetIsEditable()
3085
3086```
3087int32_t OH_PixelMap_GetIsEditable (const NativePixelMap * native, int32_t * editable )
3088```
3089
3090**Description**
3091
3092Checks whether a **NativePixelMap** object is editable.
3093
3094**Since**: 10
3095
3096**Parameters**
3097
3098| Name| Description| 
3099| -------- | -------- |
3100| native | Pointer to a **NativePixelMap** object. | 
3101| editable | Pointer to the editing type of the **NativePixelMap** object. | 
3102
3103**Returns**
3104
3105For details, see [IRNdkErrCode](#irndkerrcode-1).
3106
3107Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3108
3109Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3110
3111Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3112
3113Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3114
3115Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3116
3117Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3118
3119
3120
3121
3122### OH_PixelMap_InitNativePixelMap()
3123
3124```
3125NativePixelMap* OH_PixelMap_InitNativePixelMap (napi_env env, napi_value source )
3126```
3127
3128**Description**
3129
3130Initializes a **PixelMap** object.
3131
3132**Since**: 10
3133
3134**Parameters**
3135
3136| Name| Description| 
3137| -------- | -------- |
3138| env | Pointer to the NAPI environment. | 
3139| source | Options for setting the **PixelMap** object. | 
3140
3141**Returns**
3142
3143Returns a pointer to the **NativePixelMap** object if the operation is successful; returns an error code otherwise.
3144
3145
3146### OH_PixelMap_IsSupportAlpha()
3147
3148```
3149int32_t OH_PixelMap_IsSupportAlpha (const NativePixelMap * native, int32_t * alpha )
3150```
3151
3152**Description**
3153
3154Checks whether a **NativePixelMap** object supports alpha channels.
3155
3156**Since**: 10
3157
3158**Parameters**
3159
3160| Name| Description| 
3161| -------- | -------- |
3162| native | Pointer to a **NativePixelMap** object. | 
3163| alpha | Pointer to the support for alpha channels. | 
3164
3165**Returns**
3166
3167For details, see [IRNdkErrCode](#irndkerrcode-1).
3168
3169Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3170
3171Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3172
3173Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3174
3175Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3176
3177Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3178
3179Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3180
3181
3182
3183
3184### OH_PixelMap_Rotate()
3185
3186```
3187int32_t OH_PixelMap_Rotate (const NativePixelMap * native, float angle )
3188```
3189
3190**Description**
3191
3192Rotates a **NativePixelMap** object.
3193
3194**Since**: 10
3195
3196**Parameters**
3197
3198| Name| Description| 
3199| -------- | -------- |
3200| native | Pointer to a **NativePixelMap** object. | 
3201| angle | Angle to rotate. | 
3202
3203**Returns**
3204
3205For details, see [IRNdkErrCode](#irndkerrcode-1).
3206
3207Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3208
3209Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3210
3211Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3212
3213Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3214
3215Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3216
3217Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3218
3219Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3220
3221Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3222
3223Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3224
3225Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3226
3227Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3228
3229Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3230
3231Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3232
3233Returns **IMAGE_RESULT_CROP** if cropping fails.
3234
3235Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3236
3237Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3238
3239Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3240
3241Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3242
3243Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3244
3245Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3246
3247
3248
3249
3250### OH_PixelMap_Scale()
3251
3252```
3253int32_t OH_PixelMap_Scale (const NativePixelMap * native, float x, float y )
3254```
3255
3256**Description**
3257
3258Scales a **NativePixelMap** object.
3259
3260**Since**: 10
3261
3262**Parameters**
3263
3264| Name| Description| 
3265| -------- | -------- |
3266| native | Pointer to a **NativePixelMap** object. | 
3267| x | Scale ratio of the width. | 
3268| y | Scale ratio of the height. | 
3269
3270**Returns**
3271
3272For details, see [IRNdkErrCode](#irndkerrcode-1).
3273
3274Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3275
3276Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3277
3278Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3279
3280Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3281
3282Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3283
3284Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3285
3286Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3287
3288Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3289
3290Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3291
3292Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3293
3294Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3295
3296Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3297
3298Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3299
3300Returns **IMAGE_RESULT_INIT_ABNORMAL** if the image fails to be initialized.
3301
3302Returns **IMAGE_RESULT_CROP** if cropping fails.
3303
3304Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3305
3306Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3307
3308Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3309
3310Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3311
3312Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3313
3314Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3315
3316
3317
3318### OH_PixelMap_ScaleWithAntiAliasing()
3319
3320```
3321int32_t OH_PixelMap_ScaleWithAntiAliasing (const NativePixelMap * native, float x, float y, OH_PixelMap_AntiAliasingLevel level )
3322```
3323
3324**Description**
3325
3326Scales an image based on the specified antialiasing level, width, and height.
3327
3328**Since**: 12
3329
3330**Parameters**
3331
3332| Name| Description| 
3333| -------- | -------- |
3334| native | Pointer to a **NativePixelMap** object. | 
3335| x | Scale ratio of the width. | 
3336| y | Scale ratio of the height. | 
3337| level | Antialiasing level. | 
3338
3339**Returns**
3340
3341For details, see [IRNdkErrCode](#irndkerrcode-1).
3342
3343Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3344
3345Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3346
3347Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3348
3349Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3350
3351Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3352
3353Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3354
3355Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3356
3357Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3358
3359Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3360
3361
3362
3363### OH_PixelMap_SetAlphaAble()
3364
3365```
3366int32_t OH_PixelMap_SetAlphaAble (const NativePixelMap * native, int32_t alpha )
3367```
3368
3369**Description**
3370
3371Sets an alpha channel for a **NativePixelMap** object.
3372
3373**Since**: 10
3374
3375**Parameters**
3376
3377| Name| Description| 
3378| -------- | -------- |
3379| native | Pointer to a **NativePixelMap** object. | 
3380| alpha | Alpha channel to set. | 
3381
3382**Returns**
3383
3384For details, see [IRNdkErrCode](#irndkerrcode-1).
3385
3386Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3387
3388Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3389
3390Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3391
3392Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3393
3394Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3395
3396Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3397
3398
3399
3400### OH_PixelMap_SetDensity()
3401
3402```
3403int32_t OH_PixelMap_SetDensity (const NativePixelMap * native, int32_t density )
3404```
3405
3406**Description**
3407
3408Sets the pixel density for a **NativePixelMap** object.
3409
3410**Since**: 10
3411
3412**Parameters**
3413
3414| Name| Description| 
3415| -------- | -------- |
3416| native | Pointer to a **NativePixelMap** object. | 
3417| density | Pixel density to set. | 
3418
3419**Returns**
3420
3421For details, see [IRNdkErrCode](#irndkerrcode-1).
3422
3423Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3424
3425Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3426
3427Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3428
3429Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3430
3431Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3432
3433Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3434
3435
3436
3437
3438### OH_PixelMap_SetOpacity()
3439
3440```
3441int32_t OH_PixelMap_SetOpacity (const NativePixelMap * native, float opacity )
3442```
3443
3444**Description**
3445
3446Sets the opacity for a **NativePixelMap** object.
3447
3448**Since**: 10
3449
3450**Parameters**
3451
3452| Name| Description| 
3453| -------- | -------- |
3454| native | Pointer to a **NativePixelMap** object. | 
3455| opacity | Opacity to set. | 
3456
3457**Returns**
3458
3459For details, see [IRNdkErrCode](#irndkerrcode-1).
3460
3461Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3462
3463Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3464
3465Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3466
3467Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3468
3469Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3470
3471Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3472
3473
3474### OH_PixelMap_Translate()
3475
3476```
3477int32_t OH_PixelMap_Translate (const NativePixelMap * native, float x, float y )
3478```
3479
3480**Description**
3481
3482Translates a **NativePixelMap** object.
3483
3484**Since**: 10
3485
3486**Parameters**
3487
3488| Name| Description| 
3489| -------- | -------- |
3490| native | Pointer to a **NativePixelMap** object. | 
3491| x | Horizontal distance to translate. | 
3492| y | Vertical distance to translate. | 
3493
3494**Returns**
3495
3496For details, see [IRNdkErrCode](#irndkerrcode-1).
3497
3498Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3499
3500Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3501
3502Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3503
3504Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3505
3506Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3507
3508Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3509
3510Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3511
3512Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3513
3514Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3515
3516Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3517
3518Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3519
3520Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3521
3522Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3523
3524Returns **IMAGE_RESULT_CROP** if cropping fails.
3525
3526Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3527
3528Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3529
3530Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3531
3532Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3533
3534Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3535
3536Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3537
3538
3539
3540
3541### OH_PixelMap_UnAccessPixels()
3542
3543```
3544int32_t OH_PixelMap_UnAccessPixels (const NativePixelMap * native)
3545```
3546
3547**Description**
3548
3549Unlocks the memory of a **NativePixelMap** object. This function is used with [OH_PixelMap_AccessPixels](#oh_pixelmap_accesspixels) in pairs.
3550
3551**Since**: 10
3552
3553**Parameters**
3554
3555| Name| Description| 
3556| -------- | -------- |
3557| native | Pointer to a **NativePixelMap** object. | 
3558
3559**Returns**
3560
3561For details, see [IRNdkErrCode](#irndkerrcode-1).
3562
3563Returns **IMAGE_RESULT_SUCCESS** if the operation is successful.
3564
3565Returns **IMAGE_RESULT_BAD_PARAMETER** if a parameter is incorrect.
3566
3567Returns **IMAGE_RESULT_JNI_ENV_ABNORMAL** if the JNI environment is abnormal.
3568
3569Returns **IMAGE_RESULT_INVALID_PARAMETER** if a parameter is invalid.
3570
3571Returns **IMAGE_RESULT_GET_DATA_ABNORMAL** if an error occurs during image data retrieval.
3572
3573Returns **IMAGE_RESULT_DECODE_FAILED** if decoding fails.
3574
3575Returns **IMAGE_RESULT_CHECK_FORMAT_ERROR** if the format check fails.
3576
3577Returns **IMAGE_RESULT_THIRDPART_SKIA_ERROR** if skia decoding fails.
3578
3579Returns **IMAGE_RESULT_DATA_ABNORMAL** if the input image data is incorrect.
3580
3581Returns **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST** if sharing the memory fails.
3582
3583Returns **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL** if the data in the shared memory is abnormal.
3584
3585Returns **IMAGE_RESULT_MALLOC_ABNORMAL** if an error occurs during memory allocation.
3586
3587Returns **IMAGE_RESULT_DATA_UNSUPPORT** if the attribute is invalid or the image data is not supported.
3588
3589Returns **IMAGE_RESULT_CROP** if cropping fails.
3590
3591Returns **IMAGE_RESULT_UNKNOWN_FORMAT** if the image format is unknown.
3592
3593Returns **IMAGE_RESULT_PLUGIN_REGISTER_FAILED** if the plug-in fails to be registered.
3594
3595Returns **IMAGE_RESULT_PLUGIN_CREATE_FAILED** if the plug-in fails to be created.
3596
3597Returns **IMAGE_RESULT_INDEX_INVALID** if a parameter is invalid.
3598
3599Returns **IMAGE_RESULT_ALPHA_TYPE_ERROR** if the alpha type is incorrect.
3600
3601Returns **IMAGE_RESULT_ALLOCATER_TYPE_ERROR** if the memory allocation type is incorrect.
3602
3603
3604
3605
3606### OH_UnAccessPixels()
3607
3608```
3609int32_t OH_UnAccessPixels (napi_env env, napi_value value )
3610```
3611
3612**Description**
3613
3614Unlocks the memory of a **PixelMap** object. This function is used with **OH_AccessPixels** in pairs.
3615
3616**Deprecated from**: 10
3617
3618**Since**: 8
3619
3620**Parameters**
3621
3622| Name| Description| 
3623| -------- | -------- |
3624| env | Pointer to the NAPI environment. | 
3625| value | **PixelMap** object at the application layer. | 
3626
3627**Returns**
3628
3629Returns **OHOS_IMAGE_RESULT_SUCCESS** if the operation is successful; returns an error code otherwise.
3630
3631
3632
3633
3634## Variable Description
3635
3636
3637### alphaType
3638
3639```
3640int32_t OhosImageSourceInfo::alphaType
3641```
3642
3643**Description**
3644
3645Defines the alpha type of the image source.
3646
3647
3648
3649### buffer [1/2]
3650
3651```
3652uint8_t* OhosImageSource::buffer = nullptr
3653```
3654
3655**Description**
3656
3657Defines a pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted.
3658
3659**Since**: 10
3660
3661### buffer [2/2]
3662
3663```
3664uint8_t* OhosImageSourceUpdateData::buffer = nullptr
3665```
3666
3667**Description**
3668
3669Defines a pointer to the buffer for storing the update data.
3670
3671**Since**: 10
3672
3673
3674### bufferSize [1/2]
3675
3676```
3677size_t OhosImageSource::bufferSize = 0
3678```
3679
3680**Description**
3681
3682Defines the size of the image source buffer.
3683
3684
3685### bufferSize [2/2]
3686
3687```
3688size_t OhosImageSourceUpdateData::bufferSize = 0
3689```
3690
3691**Description**
3692
3693Defines the size of the buffer.
3694
3695**Since**: 10
3696
3697
3698### colorSpace
3699
3700```
3701int32_t OhosImageSourceInfo::colorSpace
3702```
3703
3704**Description**
3705
3706Defines the color space of the image source.
3707
3708**Since**: 10
3709
3710
3711### delayTimeList
3712
3713```
3714int32_t* OhosImageSourceDelayTimeList::delayTimeList
3715```
3716
3717**Description**
3718
3719Defines a pointer to the head of the image source delay time list.
3720
3721**Since**: 10
3722
3723
3724### density [1/2]
3725
3726```
3727int32_t OhosImageSourceOps::density
3728```
3729
3730**Description**
3731
3732Defines the pixel density of the image source.
3733
3734**Since**: 10
3735
3736
3737### density [2/2]
3738
3739```
3740int32_t OhosImageSourceInfo::density
3741```
3742
3743**Description**
3744
3745Defines the image density of the image source. It is set in [OH_ImageSource_Create](#oh_imagesource_create).
3746
3747**Since**: 10
3748
3749
3750### editable
3751
3752```
3753int8_t OhosImageDecodingOps::editable
3754```
3755
3756**Description**
3757
3758Defines whether the output pixel map is editable.
3759
3760**Since**: 10
3761
3762
3763### fd
3764
3765```
3766int32_t OhosImageSource::fd = -1
3767```
3768
3769**Description**
3770
3771Defines the descriptor of the image source.
3772
3773**Since**: 10
3774
3775
3776### fitDensity
3777
3778```
3779int32_t OhosImageDecodingOps::fitDensity
3780```
3781
3782**Description**
3783
3784Defines the pixel density of the output pixel map.
3785
3786**Since**: 10
3787
3788
3789### format
3790
3791```
3792char* OhosImageSourceSupportedFormat::format = nullptr
3793```
3794
3795**Description**
3796
3797Defines a pointer to the head of the format string.
3798
3799**Since**: 10
3800
3801
3802### height
3803
3804```
3805int32_t OhosImageRegion::height
3806```
3807
3808**Description**
3809
3810Defines the height of the region, in pixels.
3811
3812**Since**: 10
3813
3814### index
3815
3816```
3817uint32_t OhosImageDecodingOps::index
3818```
3819
3820**Description**
3821
3822Defines the index of the output pixel map.
3823
3824**Since**: 10
3825
3826
3827### isCompleted
3828
3829```
3830int8_t OhosImageSourceUpdateData::isCompleted = 0
3831```
3832
3833**Description**
3834
3835Defines whether the image source data update is completed.
3836
3837**Since**: 10
3838
3839
3840### offset
3841
3842```
3843uint32_t OhosImageSourceUpdateData::offset = 0
3844```
3845
3846**Description**
3847
3848Defines the offset of the update data in the buffer.
3849
3850**Since**: 10
3851
3852
3853### OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE
3854
3855```
3856const char* OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE = "BitsPerSample"
3857```
3858
3859**Description**
3860
3861Defines a pointer to bits per sample, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3862
3863**Since**: 10
3864
3865
3866### OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL
3867
3868```
3869const char* OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL = "CompressedBitsPerPixel"
3870```
3871
3872**Description**
3873
3874Defines a pointer to the compressed bits per pixel, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3875
3876**Since**: 10
3877
3878
3879### OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL
3880
3881```
3882const char* OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL = "DateTimeOriginal"
3883```
3884
3885**Description**
3886
3887Defines a pointer to the created date and time, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3888
3889**Since**: 10
3890
3891
3892### OHOS_IMAGE_PROPERTY_EXPOSURE_TIME
3893
3894```
3895const char* OHOS_IMAGE_PROPERTY_EXPOSURE_TIME = "ExposureTime"
3896```
3897
3898**Description**
3899
3900Defines a pointer to the exposure time, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3901
3902**Since**: 10
3903
3904
3905### OHOS_IMAGE_PROPERTY_F_NUMBER
3906
3907```
3908const char* OHOS_IMAGE_PROPERTY_F_NUMBER = "FNumber"
3909```
3910
3911**Description**
3912
3913Defines a pointer to the f-number of the image, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3914
3915**Since**: 10
3916
3917
3918### OHOS_IMAGE_PROPERTY_GPS_LATITUDE
3919
3920```
3921const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE = "GPSLatitude"
3922```
3923
3924**Description**
3925
3926Defines a pointer to the GPS latitude, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3927
3928**Since**: 10
3929
3930
3931### OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF
3932
3933```
3934const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF = "GPSLatitudeRef"
3935```
3936
3937**Description**
3938
3939Defines a pointer to the GPS latitude reference information, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3940
3941**Since**: 10
3942
3943
3944### OHOS_IMAGE_PROPERTY_GPS_LONGITUDE
3945
3946```
3947const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE = "GPSLongitude"
3948```
3949
3950**Description**
3951
3952Defines a pointer to the GPS longitude, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3953
3954**Since**: 10
3955
3956
3957### OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF
3958
3959```
3960const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF = "GPSLongitudeRef"
3961```
3962
3963**Description**
3964
3965Defines a pointer to the GPS longitude reference information, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3966
3967
3968**Since**: 10
3969
3970
3971### OHOS_IMAGE_PROPERTY_IMAGE_LENGTH
3972
3973```
3974const char* OHOS_IMAGE_PROPERTY_IMAGE_LENGTH = "ImageLength"
3975```
3976
3977**Description**
3978
3979Defines a pointer to the image length, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3980
3981**Since**: 10
3982
3983
3984### OHOS_IMAGE_PROPERTY_IMAGE_WIDTH
3985
3986```
3987const char* OHOS_IMAGE_PROPERTY_IMAGE_WIDTH = "ImageWidth"
3988```
3989
3990**Description**
3991
3992Defines a pointer to the image width, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
3993
3994
3995**Since**: 10
3996
3997
3998### OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS
3999
4000```
4001const char* OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS = "ISOSpeedRatings"
4002```
4003
4004**Description**
4005
4006Defines a pointer to the ISO speed ratings, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
4007
4008**Since**: 10
4009
4010
4011### OHOS_IMAGE_PROPERTY_ORIENTATION
4012
4013```
4014const char* OHOS_IMAGE_PROPERTY_ORIENTATION = "Orientation"
4015```
4016
4017**Description**
4018
4019Defines a pointer to the orientation, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
4020
4021**Since**: 10
4022
4023
4024### OHOS_IMAGE_PROPERTY_SCENE_TYPE
4025
4026```
4027const char* OHOS_IMAGE_PROPERTY_SCENE_TYPE = "SceneType"
4028```
4029
4030**Description**
4031
4032Defines a pointer to the scene type, one of the image properties. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).
4033
4034**Since**: 10
4035
4036
4037### pixelFormat [1/3]
4038
4039```
4040int32_t OhosImageSourceOps::pixelFormat
4041```
4042
4043**Description**
4044
4045Defines the pixel format of the image source. It is usually used to describe the YUV buffer.
4046
4047**Since**: 10
4048
4049
4050### pixelFormat [2/3]
4051
4052```
4053int32_t OhosImageDecodingOps::pixelFormat
4054```
4055
4056**Description**
4057
4058Defines the pixel format of the output pixel map.
4059
4060**Since**: 10
4061
4062
4063### pixelFormat [3/3]
4064
4065```
4066int32_t OhosImageSourceInfo::pixelFormat
4067```
4068
4069**Description**
4070
4071Defines the pixel format of the image source. It is set in [OH_ImageSource_Create](#oh_imagesource_create).
4072
4073**Since**: 10
4074
4075
4076### region
4077
4078```
4079struct OhosImageRegion OhosImageDecodingOps::region
4080```
4081
4082**Description**
4083
4084Defines the region of the output pixel map.
4085
4086**Since**: 10
4087
4088
4089### rotate
4090
4091```
4092uint32_t OhosImageDecodingOps::rotate
4093```
4094
4095**Description**
4096
4097Defines the decoding rotation options.
4098
4099**Since**: 10
4100
4101
4102### sampleSize
4103
4104```
4105uint32_t OhosImageDecodingOps::sampleSize
4106```
4107
4108**Description**
4109
4110Defines the size of the sample.
4111
4112**Since**: 10
4113
4114
4115### size [1/7]
4116
4117```
4118struct OhosImageSize OhosImageSourceOps::size
4119```
4120
4121**Description**
4122
4123Defines the pixel width and height of the image source.
4124
4125**Since**: 10
4126
4127
4128### size [2/7]
4129
4130```
4131struct OhosImageSize OhosImageDecodingOps::size
4132```
4133
4134**Description**
4135
4136Defines the pixel width and height of the output pixel map.
4137
4138**Since**: 10
4139
4140
4141### size [3/7]
4142
4143```
4144struct OhosImageSize OhosImageSourceInfo::size
4145```
4146
4147**Description**
4148
4149Defines the pixel width and height of the image source.
4150
4151**Since**: 10
4152
4153
4154### size [4/7]
4155
4156```
4157size_t OhosImageSourceDelayTimeList::size = 0
4158```
4159
4160**Description**
4161
4162Defines the size of the image source delay time list.
4163
4164**Since**: 10
4165
4166
4167### size [5/7]
4168
4169```
4170size_t OhosImageSourceSupportedFormat::size = 0
4171```
4172
4173**Description**
4174
4175Defines the size of the format string.
4176
4177**Since**: 10
4178
4179
4180### size [6/7]
4181
4182```
4183size_t OhosImageSourceSupportedFormatList::size = 0
4184```
4185
4186**Description**
4187
4188Defines the size of the format string list.
4189
4190**Since**: 10
4191
4192
4193### size [7/7]
4194
4195```
4196size_t OhosImageSourceProperty::size = 0
4197```
4198
4199**Description**
4200
4201Defines the size of the property string.
4202
4203**Since**: 10
4204
4205
4206### supportedFormatList
4207
4208```
4209struct OhosImageSourceSupportedFormat** OhosImageSourceSupportedFormatList::supportedFormatList = nullptr
4210```
4211
4212**Description**
4213
4214Defines a double pointer to the head of the format string list.
4215
4216**Since**: 10
4217
4218
4219### updateLength
4220
4221```
4222uint32_t OhosImageSourceUpdateData::updateLength = 0
4223```
4224
4225**Description**
4226
4227Defines the length of the update data in the buffer.
4228
4229**Since**: 10
4230
4231
4232### uri
4233
4234```
4235char* OhosImageSource::uri = nullptr
4236```
4237
4238**Description**
4239
4240Defines a pointer to the image source URI. Only a file URI or Base64 URI is accepted.
4241
4242**Since**: 10
4243
4244
4245### uriSize
4246
4247```
4248size_t OhosImageSource::uriSize = 0
4249```
4250
4251**Description**
4252
4253Defines the length of the image source URI.
4254
4255**Since**: 10
4256
4257
4258### value
4259
4260```
4261char* OhosImageSourceProperty::value = nullptr
4262```
4263
4264**Description**
4265
4266Defines a pointer to the head of the property string.
4267
4268**Since**: 10
4269
4270
4271### width
4272
4273```
4274int32_t OhosImageRegion::width
4275```
4276
4277**Description**
4278
4279Defines the width of the region, in pixels.
4280
4281**Since**: 10
4282
4283
4284### x
4285
4286```
4287int32_t OhosImageRegion::x
4288```
4289
4290**Description**
4291
4292Defines the X coordinate of the start point, in pixels.
4293
4294**Since**: 10
4295
4296
4297### y
4298
4299```
4300int32_t OhosImageRegion::y
4301```
4302
4303**Description**
4304
4305Defines the Y coordinate of the start point, in pixels.
4306
4307**Since**: 10
4308