1# image_source_mdk.h 2<!--Kit: Image Kit--> 3<!--Subsystem: Multimedia--> 4<!--Owner: @aulight02--> 5<!--SE: @liyang_bryan--> 6<!--TSE: @xchaosioda--> 7 8## Overview 9 10The file declares the APIs used to decode an image source into a PixelMap. 11 12**Library**: libimage_source_ndk.z.so 13 14**File to include**: <multimedia/image_framework/image_source_mdk.h> 15 16**Since**: 10 17 18**Related module**: [Image](capi-image.md) 19 20## Summary 21 22### Structs 23 24| Name| typedef Keyword| Description| 25| -- | -- | -- | 26| [OhosImageRegion](capi-image-ohosimageregion.md) | - | Describes the region of an image source to decode. It is a member variable of [OhosImageDecodingOps](capi-image-ohosimagedecodingops.md).| 27| [ImageSourceNative_](capi-image-imagesourcenative-.md) | ImageSourceNative | Describes an image source object at the native layer.| 28| [OhosImageSourceOps](capi-image-ohosimagesourceops.md) | - | Describes the image source options. It is used in [OH_ImageSource_Create](#oh_imagesource_create) and [OH_ImageSource_CreateIncremental](#oh_imagesource_createincremental).| 29| [OhosImageDecodingOps](capi-image-ohosimagedecodingops.md) | - | Describes the options for decoding an image source. It is used in [OH_ImageSource_CreatePixelMap](#oh_imagesource_createpixelmap) and [OH_ImageSource_CreatePixelMapList](#oh_imagesource_createpixelmaplist).| 30| [OhosImageSourceInfo](capi-image-ohosimagesourceinfo.md) | - | Describes the image source information, which is obtained by calling [OH_ImageSource_GetImageInfo](#oh_imagesource_getimageinfo).| 31| [OhosImageSource](capi-image-ohosimagesource.md) | - | Describes the input resource of an image source. Only one type of resource is accepted at a time. The image source is obtained by calling [OH_ImageSource_Create](#oh_imagesource_create).| 32| [OhosImageSourceDelayTimeList](capi-image-ohosimagesourcedelaytimelist.md) | - | Describes the delay time list of an image source. The delay time list is obtained by calling [OH_ImageSource_GetDelayTime](#oh_imagesource_getdelaytime).| 33| [OhosImageSourceSupportedFormat](capi-image-ohosimagesourcesupportedformat.md) | - | Describes the format string supported by an image source. It is used in [OhosImageSourceSupportedFormatList](capi-image-ohosimagesourcesupportedformatlist.md) and [OH_ImageSource_GetSupportedFormats](#oh_imagesource_getsupportedformats).| 34| [OhosImageSourceSupportedFormatList](capi-image-ohosimagesourcesupportedformatlist.md) | - | Describes the format string list supported by an image source. It is obtained by calling [OH_ImageSource_GetSupportedFormats](#oh_imagesource_getsupportedformats).| 35| [OhosImageSourceProperty](capi-image-ohosimagesourceproperty.md) | - | Describes the property string (in key-value format) of an image source. It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).| 36| [OhosImageSourceUpdateData](capi-image-ohosimagesourceupdatedata.md) | - | Describes the update data option of the image source. It is obtained by calling [OH_ImageSource_UpdateData](#oh_imagesource_updatedata).| 37 38### Functions 39 40| Name| Description| 41| -- | -- | 42| [int32_t OH_ImageSource_Create(napi_env env, struct OhosImageSource* src, struct OhosImageSourceOps* ops, napi_value *res)](#oh_imagesource_create) | Creates an ImageSource object at the JavaScript native layer based on the specified OhosImageSource and OhosImageSourceOps structs.| 43| [int32_t OH_ImageSource_CreateFromUri(napi_env env, char* uri, size_t size,struct OhosImageSourceOps* ops, napi_value *res)](#oh_imagesource_createfromuri) | Creates an ImageSource object at the JavaScript native layer based on the specified URI and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) struct.| 44| [int32_t OH_ImageSource_CreateFromFd(napi_env env, int32_t fd,struct OhosImageSourceOps* ops, napi_value *res)](#oh_imagesource_createfromfd) | Creates an ImageSource object at the JavaScript native layer based on the specified file descriptor and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) struct.| 45| [int32_t OH_ImageSource_CreateFromData(napi_env env, uint8_t* data, size_t dataSize,struct OhosImageSourceOps* ops, napi_value *res)](#oh_imagesource_createfromdata) | Creates an ImageSource object at the JavaScript native layer based on the specified image source buffer (defined by **data**) and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) struct.| 46| [int32_t OH_ImageSource_CreateFromRawFile(napi_env env, RawFileDescriptor rawFile,struct OhosImageSourceOps* ops, napi_value *res)](#oh_imagesource_createfromrawfile) | Creates an ImageSource object at the JavaScript native layer based on the specified [RawFileDescriptor](../apis-localization-kit/capi-rawfile-rawfiledescriptor.md) and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) structs.| 47| [int32_t OH_ImageSource_CreateIncremental(napi_env env, struct OhosImageSource* source, struct OhosImageSourceOps* ops, napi_value *res)](#oh_imagesource_createincremental) | Creates an ImageSource object at the JavaScript native layer based on the specified [OhosImageSource](capi-image-ohosimagesource.md) and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) structs. The image source data will be updated through [OH_ImageSource_UpdateData](#oh_imagesource_updatedata).| 48| [int32_t OH_ImageSource_CreateIncrementalFromData(napi_env env, uint8_t* data, size_t dataSize,struct OhosImageSourceOps* ops, napi_value *res)](#oh_imagesource_createincrementalfromdata) | 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](capi-image-ohosimagesourceops.md) struct. The image data is updated through [OH_ImageSource_UpdateData](#oh_imagesource_updatedata).| 49| [int32_t OH_ImageSource_GetSupportedFormats(struct OhosImageSourceSupportedFormatList* res)](#oh_imagesource_getsupportedformats) | Obtains all supported decoding formats.| 50| [ImageSourceNative* OH_ImageSource_InitNative(napi_env env, napi_value source)](#oh_imagesource_initnative) | Converts an ImageSource object at the JavaScript native layer into an [ImageSourceNative](capi-image-imagesourcenative-.md) object.| 51| [int32_t OH_ImageSource_CreatePixelMap(const ImageSourceNative* native,struct OhosImageDecodingOps* ops, napi_value *res)](#oh_imagesource_createpixelmap) | Decodes an ImageSourceNative object to obtain a PixelMap object at the JavaScript native layer based on the specified [OhosImageDecodingOps](capi-image-ohosimagedecodingops.md) struct.| 52| [int32_t OH_ImageSource_CreatePixelMapList(const ImageSourceNative* native,struct OhosImageDecodingOps* ops, napi_value *res)](#oh_imagesource_createpixelmaplist) | Decodes an ImageSourceNative object to obtain all PixelMap objects at the JavaScript native layer based on the specified [OhosImageDecodingOps](capi-image-ohosimagedecodingops.md) struct.| 53| [int32_t OH_ImageSource_GetDelayTime(const ImageSourceNative* native,struct OhosImageSourceDelayTimeList* res)](#oh_imagesource_getdelaytime) | Obtains the delay time list from an ImageSourceNative object (such as GIF image source).| 54| [int32_t OH_ImageSource_GetFrameCount(const ImageSourceNative* native, uint32_t *res)](#oh_imagesource_getframecount) | Obtains the number of frames from an ImageSourceNative object.| 55| [int32_t OH_ImageSource_GetImageInfo(const ImageSourceNative* native, int32_t index,struct OhosImageSourceInfo* info)](#oh_imagesource_getimageinfo) | Obtains image source information from an ImageSourceNative object by index.| 56| [int32_t OH_ImageSource_GetImageProperty(const ImageSourceNative* native, struct OhosImageSourceProperty* key, struct OhosImageSourceProperty* value)](#oh_imagesource_getimageproperty) | Obtains the value of an image property from an ImageSourceNative object.| 57| [int32_t OH_ImageSource_UpdateData(const ImageSourceNative* native, struct OhosImageSourceUpdateData* data)](#oh_imagesource_updatedata) | Updates the data of an ImageSourceNative object.| 58| [int32_t OH_ImageSource_Release(ImageSourceNative* native)](#oh_imagesource_release) | Releases an ImageSourceNative object.| 59 60### Variables 61 62| Name| Description| 63| -- | -- | 64| const char* OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE = "BitsPerSample" | Pointer to bits per sample, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 65| const char* OHOS_IMAGE_PROPERTY_ORIENTATION = "Orientation" | Pointer to the orientation, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 66| const char* OHOS_IMAGE_PROPERTY_IMAGE_LENGTH = "ImageLength" | Pointer to the image length, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 67| const char* OHOS_IMAGE_PROPERTY_IMAGE_WIDTH = "ImageWidth" | Pointer to the image width, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 68| const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE = "GPSLatitude" | Pointer to the GPS latitude, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 69| const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE = "GPSLongitude" | Pointer to the GPS longitude, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 70| const char* OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF = "GPSLatitudeRef" | Pointer to the GPS latitude reference information, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 71| const char* OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF = "GPSLongitudeRef" | Pointer to the GPS longitude reference information, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 72| const char* OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL = "DateTimeOriginal" | Pointer to the created date and time, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 73| const char* OHOS_IMAGE_PROPERTY_EXPOSURE_TIME = "ExposureTime" | Pointer to the exposure time, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 74| const char* OHOS_IMAGE_PROPERTY_SCENE_TYPE = "SceneType" | Pointer to the scene type, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 75| const char* OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS = "ISOSpeedRatings" | Pointer to the ISO speed ratings, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 76| const char* OHOS_IMAGE_PROPERTY_F_NUMBER = "FNumber" | Pointer to the f-number of the image, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 77| const char* OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL = "CompressedBitsPerPixel" | Pointer to the compressed bits per pixel, one of the image properties.<br>It is used in [OH_ImageSource_GetImageProperty](#oh_imagesource_getimageproperty) and [OH_ImageSource_ModifyImageProperty](#oh_imagesource_modifyimageproperty).<br>**Since**: 10| 78 79## Function Description 80 81### OH_ImageSource_Create() 82 83``` 84int32_t OH_ImageSource_Create(napi_env env, struct OhosImageSource* src, struct OhosImageSourceOps* ops, napi_value *res) 85``` 86 87**Description** 88 89Creates an ImageSource object at the JavaScript native layer based on the specified OhosImageSource and OhosImageSourceOps structs. 90 91**Since**: 10 92 93**Deprecated from**: 11 94 95**Substitute**: [OH_ImageSource_CreateFromUri](#oh_imagesource_createfromuri), [OH_ImageSource_CreateFromFd](#oh_imagesource_createfromfd), and [OH_ImageSource_CreateFromData](#oh_imagesource_createfromdata) 96 97**Parameters** 98 99| Name| Description| 100| -- | -- | 101| napi_env env | Pointer to the JNI environment.| 102| struct OhosImageSource* src | Pointer to the input resource of the image source.| 103| struct [OhosImageSourceOps](capi-image-ohosimagesourceops.md)* ops | Pointer to the options for creating the image source.| 104| napi_value *res | Pointer to an ImageSource object at the JavaScript native layer.| 105 106**Returns** 107 108| Type| Description| 109| -- | -- | 110| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br>**IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br>**IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br>**IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br>**IMAGE_RESULT_SOURCE_DATA_INCOMPLETE**: The image source data is incomplete.<br>**IMAGE_RESULT_SOURCE_DATA**: The image source data is incorrect.<br>IMAGE_RESULT_GET_DATA_ABNORMAL: An error occurs during image data retrieval.<br>**IMAGE_RESULT_TOO_LARGE**: The image data is too large.<br>**IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br>**IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br>**IMAGE_RESULT_DECODE_EXIF_UNSUPPORT**: EXIF is not supported for image decoding.<br>**IMAGE_RESULT_PROPERTY_NOT_EXIST**: The image property does not exist.<br>**IMAGE_RESULT_FILE_DAMAGED**: The file is damaged.<br>**IMAGE_RESULT_FILE_FD_ERROR**: The file descriptor is incorrect.<br>**IMAGE_RESULT_STREAM_SIZE_ERROR**: The data stream is incorrect.<br>**IMAGE_RESULT_SEEK_FAILED**: Seeking the file fails.<br>**IMAGE_RESULT_PEEK_FAILED**: Peeking the file fails.<br>**IMAGE_RESULT_FREAD_FAILED**: Reading the file fails.| 111 112### OH_ImageSource_CreateFromUri() 113 114``` 115int32_t OH_ImageSource_CreateFromUri(napi_env env, char* uri, size_t size,struct OhosImageSourceOps* ops, napi_value *res) 116``` 117 118**Description** 119 120Creates an ImageSource object at the JavaScript native layer based on the specified URI and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) struct. 121 122**Since**: 11 123 124 125**Parameters** 126 127| Name| Description| 128| -- | -- | 129| napi_env env | Pointer to the JNI environment.| 130| char* uri | Pointer to the image source URI. Only a file URI or Base64 URI is accepted. Currently, only absolute paths are supported.| 131| size_t size | Length of the image source URI.| 132| struct [OhosImageSourceOps](capi-image-ohosimagesourceops.md)* ops | Pointer to the options for creating the image source.| 133| napi_value *res | Pointer to an ImageSource object at the JavaScript native layer.| 134 135**Returns** 136 137| Type| Description| 138| -- | -- | 139| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.| 140 141### OH_ImageSource_CreateFromFd() 142 143``` 144int32_t OH_ImageSource_CreateFromFd(napi_env env, int32_t fd,struct OhosImageSourceOps* ops, napi_value *res) 145``` 146 147**Description** 148 149Creates an ImageSource object at the JavaScript native layer based on the specified file descriptor and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) struct. 150 151**Since**: 11 152 153 154**Parameters** 155 156| Name| Description| 157| -- | -- | 158| napi_env env | Pointer to the JNI environment.| 159| int32_t fd | Descriptor of the image source.| 160| struct [OhosImageSourceOps](capi-image-ohosimagesourceops.md)* ops | Pointer to the options for creating the image source.| 161| napi_value *res | Pointer to an ImageSource object at the JavaScript native layer.| 162 163**Returns** 164 165| Type| Description| 166| -- | -- | 167| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.| 168 169### OH_ImageSource_CreateFromData() 170 171``` 172int32_t OH_ImageSource_CreateFromData(napi_env env, uint8_t* data, size_t dataSize,struct OhosImageSourceOps* ops, napi_value *res) 173``` 174 175**Description** 176 177Creates an ImageSource object at the JavaScript native layer based on the specified image source buffer (defined by **data**) and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) struct. 178 179**Since**: 11 180 181 182**Parameters** 183 184| Name| Description| 185| -- | -- | 186| napi_env env | Pointer to the JNI environment.| 187| uint8_t* data | Pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted.| 188| size_t dataSize | Size of the image source buffer.| 189| struct [OhosImageSourceOps](capi-image-ohosimagesourceops.md)* ops | Pointer to the options for creating the image source.| 190| napi_value *res | Pointer to an ImageSource object at the JavaScript native layer.| 191 192**Returns** 193 194| Type| Description| 195| -- | -- | 196| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.| 197 198### OH_ImageSource_CreateFromRawFile() 199 200``` 201int32_t OH_ImageSource_CreateFromRawFile(napi_env env, RawFileDescriptor rawFile,struct OhosImageSourceOps* ops, napi_value *res) 202``` 203 204**Description** 205 206Creates an ImageSource object at the JavaScript native layer based on the specified [RawFileDescriptor](../apis-localization-kit/capi-rawfile-rawfiledescriptor.md) and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) structs. 207 208**Since**: 11 209 210 211**Parameters** 212 213| Name| Description| 214| -- | -- | 215| napi_env env | Pointer to the JNI environment.| 216| [RawFileDescriptor](../apis-localization-kit/capi-rawfile-rawfiledescriptor.md) rawFile | Descriptor of the image source resource.| 217| struct [OhosImageSourceOps](capi-image-ohosimagesourceops.md)* ops | Pointer to the options for creating the image source.| 218| napi_value *res | Pointer to an ImageSource object at the JavaScript native layer.| 219 220**Returns** 221 222| Type| Description| 223| -- | -- | 224| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.| 225 226 227### OH_ImageSource_CreateIncremental() 228 229``` 230int32_t OH_ImageSource_CreateIncremental(napi_env env, struct OhosImageSource* source, struct OhosImageSourceOps* ops, napi_value *res) 231``` 232 233**Description** 234 235Creates an ImageSource object at the JavaScript native layer based on the specified [OhosImageSource](capi-image-ohosimagesource.md) and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) structs. The image source data will be updated through [OH_ImageSource_UpdateData](#oh_imagesource_updatedata). 236 237**Since**: 10 238 239**Deprecated from**: 11 240 241**Substitute**: [OH_ImageSource_CreateIncrementalFromData](#oh_imagesource_createincrementalfromdata) 242 243 244**Parameters** 245 246| Name| Description| 247| -- | -- | 248| napi_env env | Pointer to the JNI environment.| 249| struct [OhosImageSource](capi-image-ohosimagesource.md)* source | Pointer to the input resource of the image source. Only the buffer type is accepted.| 250| struct [OhosImageSourceOps](capi-image-ohosimagesourceops.md)* ops | Pointer to the options for creating the image source.| 251| napi_value *res | Pointer to an ImageSource object at the JavaScript native layer.| 252 253**Returns** 254 255| Type| Description| 256| -- | -- | 257| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.| 258 259### OH_ImageSource_CreateIncrementalFromData() 260 261``` 262int32_t OH_ImageSource_CreateIncrementalFromData(napi_env env, uint8_t* data, size_t dataSize,struct OhosImageSourceOps* ops, napi_value *res) 263``` 264 265**Description** 266 267Creates an ImageSource object of the incremental type at the JavaScript native layer based on the specified image source buffer (defined by **data**) and [OhosImageSourceOps](capi-image-ohosimagesourceops.md) struct. The image data is updated through [OH_ImageSource_UpdateData](#oh_imagesource_updatedata). 268 269**Since**: 11 270 271 272**Parameters** 273 274| Name| Description| 275| -- | -- | 276| napi_env env | Pointer to the JNI environment.| 277| uint8_t* data | Pointer to the image source buffer. Only a formatted packet buffer or Base64 buffer is accepted.| 278| size_t dataSize | Size of the image source buffer.| 279| struct [OhosImageSourceOps](capi-image-ohosimagesourceops.md)* ops | Pointer to the options for creating the image source.| 280| napi_value *res | Pointer to an ImageSource object at the JavaScript native layer.| 281 282**Returns** 283 284| Type| Description| 285| -- | -- | 286| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.| 287 288### OH_ImageSource_GetSupportedFormats() 289 290``` 291int32_t OH_ImageSource_GetSupportedFormats(struct OhosImageSourceSupportedFormatList* res) 292``` 293 294**Description** 295 296Obtains all supported decoding formats. 297 298**Since**: 10 299 300 301**Parameters** 302 303| Name| Description| 304| -- | -- | 305| struct OhosImageSourceSupportedFormatList* res | Pointer to the [OhosImageSourceSupportedFormatList](capi-image-ohosimagesourcesupportedformatlist.md) struct.<br>If the input **supportedFormatList** is a null pointer and **size** is 0, the size of the supported formats is returned through **ressize**.<br>To obtain all formats, a space larger than **size** is required. In addition, sufficient space must be reserved for each format supported.| 306 307**Returns** 308 309| Type| Description| 310| -- | -- | 311| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The check format is incorrect.| 312 313### OH_ImageSource_InitNative() 314 315``` 316ImageSourceNative* OH_ImageSource_InitNative(napi_env env, napi_value source) 317``` 318 319**Description** 320 321Converts an ImageSource object at the JavaScript native layer into an [ImageSourceNative](capi-image-imagesourcenative-.md) object. 322 323**Since**: 10 324 325 326**Parameters** 327 328| Name| Description| 329| -- | -- | 330| napi_env env | Pointer to the JNI environment.| 331| napi_value source | Pointer to an ImageSource object at the JavaScript native layer.| 332 333**Returns** 334 335| Type| Description| 336| -- | -- | 337| [ImageSourceNative](capi-image-imagesourcenative-.md)* | Pointer to the [ImageSourceNative](capi-image-imagesourcenative-.md) object. If the operation fails, a null pointer is returned.| 338 339**See also** 340 341[OH_ImageSource_Release](#oh_imagesource_release) 342 343### OH_ImageSource_CreatePixelMap() 344 345``` 346int32_t OH_ImageSource_CreatePixelMap(const ImageSourceNative* native,struct OhosImageDecodingOps* ops, napi_value *res) 347``` 348 349**Description** 350 351Decodes an ImageSourceNative object to obtain a PixelMap object at the JavaScript native layer based on the specified [OhosImageDecodingOps](capi-image-ohosimagedecodingops.md) struct. 352 353**Since**: 10 354 355 356**Parameters** 357 358| Name| Description| 359| -- | -- | 360| const [ImageSourceNative](capi-image-imagesourcenative-.md)* native | Pointer to an ImageSourceNative object.| 361| struct [OhosImageDecodingOps](capi-image-ohosimagedecodingops.md)* ops | Pointer to the options for decoding the image source.| 362| napi_value *res | Pointer to a PixelMap object at the JavaScript native layer.| 363 364**Returns** 365 366| Type| Description| 367| -- | -- | 368| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: Failed to obtain image data.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: Failed to create the decoder.<br> **IMAGE_RESULT_CREATE_ENCODER_FAILED**: Failed to create the encoder.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The check format is incorrect.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia error.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The input image data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: The shared memory does not exist.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is abnormal.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: The image is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: Image initialization error.<br> **IMAGE_RESULT_INIT_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_CROP**: An error occurs during image cropping.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: Failed to register the plugin.<br> **IMAGE_RESULT_PLUGIN_CREATE_FAILED**: Failed to create the plugin.<br> **IMAGE_RESULT_ENCODE_FAILED**: Failed to add the PixelMap.<br> **IMAGE_RESULT_HW_DECODE_UNSUPPORT**: Image hardware decoding is not supported.<br> **IMAGE_RESULT_HW_DECODE_FAILED**: Hardware decoding fails.<br>**IMAGE_RESULT_ERR_IPC**: IPC fails.<br> **IMAGE_RESULT_INDEX_INVALID**: The index is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: Hardware decoding fails.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: Hardware decoding fails.| 369 370### OH_ImageSource_CreatePixelMapList() 371 372``` 373int32_t OH_ImageSource_CreatePixelMapList(const ImageSourceNative* native,struct OhosImageDecodingOps* ops, napi_value *res) 374``` 375 376**Description** 377 378Decodes an ImageSourceNative object to obtain all PixelMap objects at the JavaScript native layer based on the specified [OhosImageDecodingOps](capi-image-ohosimagedecodingops.md) struct. 379 380**Since**: 10 381 382 383**Parameters** 384 385| Name| Description| 386| -- | -- | 387| const [ImageSourceNative](capi-image-imagesourcenative-.md)* native | Pointer to an ImageSourceNative object.| 388| struct [OhosImageDecodingOps](capi-image-ohosimagedecodingops.md)* ops | Pointer to the options for decoding the image source.| 389| napi_value *res | Pointer to PixelMap objects at the JavaScript native layer.| 390 391**Returns** 392 393| Type| Description| 394| -- | -- | 395| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: Failed to obtain image data.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: Failed to create the decoder.<br> **IMAGE_RESULT_CREATE_ENCODER_FAILED**: Failed to create the encoder.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The check format is incorrect.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia error.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The input image data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: The shared memory does not exist.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is abnormal.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: The image is incorrect.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: Image initialization error.<br> **IMAGE_RESULT_INIT_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_CROP**: An error occurs during image cropping.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: Failed to register the plugin.<br> **IMAGE_RESULT_PLUGIN_CREATE_FAILED**: Failed to create the plugin.<br> **IMAGE_RESULT_ENCODE_FAILED**: Failed to add the PixelMap.<br> **IMAGE_RESULT_HW_DECODE_UNSUPPORT**: Image hardware decoding is not supported.<br> **IMAGE_RESULT_HW_DECODE_FAILED**: Hardware decoding fails.<br>**IMAGE_RESULT_ERR_IPC**: IPC fails.<br> **IMAGE_RESULT_INDEX_INVALID**: The index is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: Hardware decoding fails.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: Hardware decoding fails.<br> **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT**: EXIF is not supported for image decoding.<br> **IMAGE_RESULT_PROPERTY_NOT_EXIST**: The image property does not exist.| 396 397### OH_ImageSource_GetDelayTime() 398 399``` 400int32_t OH_ImageSource_GetDelayTime(const ImageSourceNative* native,struct OhosImageSourceDelayTimeList* res) 401``` 402 403**Description** 404 405Obtains the delay time list from an ImageSourceNative object (such as GIF image source). 406 407**Since**: 10 408 409 410**Parameters** 411 412| Name| Description| 413| -- | -- | 414| const [ImageSourceNative](capi-image-imagesourcenative-.md)* native | Pointer to an ImageSourceNative object.| 415| struct [OhosImageSourceDelayTimeList](capi-image-ohosimagesourcedelaytimelist.md)* res | Pointer to the OhosImageSourceDelayTimeList object obtained.<br>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.| 416 417**Returns** 418 419| Type| Description| 420| -- | -- | 421| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: Failed to obtain image data.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: Failed to create the decoder.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia error.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The input image data is incorrect.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: Image initialization error.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: Failed to register the plugin.<br> **IMAGE_RESULT_PLUGIN_CREATE_FAILED**: Failed to create the plugin.<br> **IMAGE_RESULT_INDEX_INVALID**: The index is invalid.<br> **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT**: EXIF is not supported for image decoding.<br> **IMAGE_RESULT_PROPERTY_NOT_EXIST**: The image property does not exist.| 422 423### OH_ImageSource_GetFrameCount() 424 425``` 426int32_t OH_ImageSource_GetFrameCount(const ImageSourceNative* native, uint32_t *res) 427``` 428 429**Description** 430 431Obtains the number of frames from an ImageSourceNative object. 432 433**Since**: 10 434 435 436**Parameters** 437 438| Name| Description| 439| -- | -- | 440| const [ImageSourceNative](capi-image-imagesourcenative-.md)* native | Pointer to an ImageSourceNative object.| 441| uint32_t *res | Pointer to the frame count.| 442 443**Returns** 444 445| Type| Description| 446| -- | -- | 447| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: Failed to obtain image data.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: Failed to create the decoder.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia error.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The input image data is incorrect.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: Image initialization error.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: Failed to register the plugin.<br> **IMAGE_RESULT_PLUGIN_CREATE_FAILED**: Failed to create the plugin.<br> **IMAGE_RESULT_INDEX_INVALID**: The index is invalid.<br> **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT**: EXIF is not supported for image decoding.<br> **IMAGE_RESULT_PROPERTY_NOT_EXIST**: The image property does not exist.| 448 449### OH_ImageSource_GetImageInfo() 450 451``` 452int32_t OH_ImageSource_GetImageInfo(const ImageSourceNative* native, int32_t index,struct OhosImageSourceInfo* info) 453``` 454 455**Description** 456 457Obtains image source information from an ImageSourceNative object by index. 458 459**Since**: 10 460 461 462**Parameters** 463 464| Name| Description| 465| -- | -- | 466| const [ImageSourceNative](capi-image-imagesourcenative-.md)* native | Pointer to an ImageSourceNative object.| 467| int32_t index | Index.| 468| struct [OhosImageSourceInfo](capi-image-ohosimagesourceinfo.md)* info | Pointer to the OhosImageSourceInfo object obtained.| 469 470**Returns** 471 472| Type| Description| 473| -- | -- | 474| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br>**OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: Failed to obtain image data.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: Failed to create the decoder.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia error.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The input image data is incorrect.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: Image initialization error.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: Failed to register the plugin.<br> **IMAGE_RESULT_PLUGIN_CREATE_FAILED**: Failed to create the plugin.<br> **IMAGE_RESULT_INDEX_INVALID**: The index is invalid.<br> **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT**: EXIF is not supported for image decoding.<br> **IMAGE_RESULT_PROPERTY_NOT_EXIST**: The image property does not exist.| 475 476### OH_ImageSource_GetImageProperty() 477 478``` 479int32_t OH_ImageSource_GetImageProperty(const ImageSourceNative* native, struct OhosImageSourceProperty* key, struct OhosImageSourceProperty* value) 480``` 481 482**Description** 483 484Obtains the value of an image property from an ImageSourceNative object. 485 486**Since**: 10 487 488 489**Parameters** 490 491| Name| Description| 492| -- | -- | 493| const [ImageSourceNative](capi-image-imagesourcenative-.md)* native | Pointer to an ImageSourceNative object.| 494| struct [OhosImageSourceProperty](capi-image-ohosimagesourceproperty.md)* key | Pointer to the property. For details, see **OhosImageSourceProperty**.| 495| struct [OhosImageSourceProperty](capi-image-ohosimagesourceproperty.md)* value | Pointer to the OhosImageSourceProperty 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.| 496 497**Returns** 498 499| Type| Description| 500| -- | -- | 501| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br> **OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: Failed to obtain image data.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: Failed to create the decoder.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia error.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The input image data is incorrect.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: Image initialization error.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: Failed to register the plugin.<br> **IMAGE_RESULT_PLUGIN_CREATE_FAILED**: Failed to create the plugin.<br> **IMAGE_RESULT_INDEX_INVALID**: The index is invalid.<br> **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT**: EXIF is not supported for image decoding.<br> **IMAGE_RESULT_PROPERTY_NOT_EXIST**: The image property does not exist.| 502 503### OH_ImageSource_ModifyImageProperty() 504 505``` 506int32_t OH_ImageSource_ModifyImageProperty(const ImageSourceNative* native, struct OhosImageSourceProperty* key, struct OhosImageSourceProperty* value) 507``` 508 509**Description** 510 511Modifies the value of an image property of an ImageSourceNative object. 512 513**Since**: 10 514 515 516**Parameters** 517 518| Name| Description| 519| -- | -- | 520| const [ImageSourceNative](capi-image-imagesourcenative-.md)* native | Pointer to an ImageSourceNative object.| 521| struct [OhosImageSourceProperty](capi-image-ohosimagesourceproperty.md)* key | Pointer to the property. For details, see **OhosImageSourceProperty**.| 522| struct [OhosImageSourceProperty](capi-image-ohosimagesourceproperty.md)* value | Pointer to the new value of the property.| 523 524**Returns** 525 526| Type| Description| 527| -- | -- | 528| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br> **OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: Failed to obtain image data.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: Failed to create the decoder.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: Skia error.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The input image data is incorrect.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: Image initialization error.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: Failed to register the plugin.<br> **IMAGE_RESULT_PLUGIN_CREATE_FAILED**: Failed to create the plugin.<br> **IMAGE_RESULT_INDEX_INVALID**: The index is invalid.<br> **IMAGE_RESULT_DECODE_EXIF_UNSUPPORT**: EXIF is not supported for image decoding.<br> **IMAGE_RESULT_PROPERTY_NOT_EXIST**: The image property does not exist.| 529 530### OH_ImageSource_UpdateData() 531 532``` 533int32_t OH_ImageSource_UpdateData(const ImageSourceNative* native, struct OhosImageSourceUpdateData* data) 534``` 535 536**Description** 537 538Updates the data of an ImageSourceNative object. 539 540**Since**: 10 541 542 543**Parameters** 544 545| Name| Description| 546| -- | -- | 547| const [ImageSourceNative](capi-image-imagesourcenative-.md)* native | Pointer to an ImageSourceNative object.| 548| struct [OhosImageSourceUpdateData](capi-image-ohosimagesourceupdatedata.md)* data | Pointer to the update data. For details, see **OhosImageSourceUpdateData**.| 549 550**Returns** 551 552| Type| Description| 553| -- | -- | 554| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br> **OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: Failed to obtain image data.<br> **IMAGE_RESULT_DECODE_FAILED**: Decoding fails.<br> **IMAGE_RESULT_DECODE_HEAD_ABNORMAL**: An error occurs during decoding of the image header.<br> **IMAGE_RESULT_CREATE_DECODER_FAILED**: Failed to create the decoder.<br> **IMAGE_RESULT_CREATE_ENCODER_FAILED**: Failed to create the encoder.<br> **IMAGE_RESULT_CHECK_FORMAT_ERROR**: The check format is incorrect.<br> **IMAGE_RESULT_THIRDPART_SKIA_ERROR**: An error occurs in the Skia third-party library.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The input image data is incorrect.<br> **IMAGE_RESULT_ERR_SHAMEM_NOT_EXIST**: The shared memory does not exist.<br> **IMAGE_RESULT_ERR_SHAMEM_DATA_ABNORMAL**: Data in the shared memory is abnormal.<br> **IMAGE_RESULT_DECODE_ABNORMAL**: Image decoding fails.<br> **IMAGE_RESULT_MALLOC_ABNORMAL**: An error occurs during memory allocation.<br> **IMAGE_RESULT_DATA_UNSUPPORT**: Image initialization error.<br> **IMAGE_RESULT_INIT_ABNORMAL**: The image input data is incorrect.<br> **IMAGE_RESULT_CROP**: An error occurs during image cropping.<br> **IMAGE_RESULT_UNKNOWN_FORMAT**: The image format is unknown.<br> **IMAGE_RESULT_PLUGIN_REGISTER_FAILED**: Failed to register the plugin.<br> **IMAGE_RESULT_PLUGIN_CREATE_FAILED**: Failed to create the plugin.<br> **IMAGE_RESULT_ENCODE_FAILED**: Failed to add the PixelMap.<br> **IMAGE_RESULT_HW_DECODE_UNSUPPORT**: Image hardware decoding is not supported.<br> **IMAGE_RESULT_HW_DECODE_FAILED**: Hardware decoding fails.<br> **IMAGE_RESULT_ERR_IPC**: IPC fails.<br> **IMAGE_RESULT_INDEX_INVALID**: The index is invalid.<br> **IMAGE_RESULT_ALPHA_TYPE_ERROR**: The alpha type is incorrect.<br> **IMAGE_RESULT_ALLOCATER_TYPE_ERROR**: The memory allocator type is incorrect.| 555 556### OH_ImageSource_Release() 557 558``` 559int32_t OH_ImageSource_Release(ImageSourceNative* native) 560``` 561 562**Description** 563 564Releases an ImageSourceNative object. 565 566**Since**: 10 567 568 569**Parameters** 570 571| Name| Description| 572| -- | -- | 573| [ImageSourceNative](capi-image-imagesourcenative-.md)* native | Pointer to an ImageSourceNative object.| 574 575**Returns** 576 577| Type| Description| 578| -- | -- | 579| int32_t | Result code defined in [IRNdkErrCode](capi-image-mdk-common-h.md#irndkerrcode):<br> **OHOS_IMAGE_RESULT_SUCCESS**: The operation is successful.<br> **IMAGE_RESULT_BAD_PARAMETER**: A parameter is incorrect.<br> **IMAGE_RESULT_JNI_ENV_ABNORMAL**: The JNI environment is abnormal.<br> **IMAGE_RESULT_INVALID_PARAMETER**: A parameter is invalid.<br> **IMAGE_RESULT_GET_DATA_ABNORMAL**: Failed to obtain image data.<br> **IMAGE_RESULT_DATA_ABNORMAL**: The input image data is incorrect.| 580 581**See also** 582 583[OH_ImageSource_Create](#oh_imagesource_create), [OH_ImageSource_CreateIncremental](#oh_imagesource_createincremental) 584