1e41f4b71Sopenharmony_ci# image_source_mdk.h
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## Overview
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciThe **image_source_mdk.h** file declares the APIs used to decode an image source into a pixel map.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ci**Library**: libimage_source_ndk.z.so
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci**File to include**: <multimedia/image_framework/image_source_mdk.h>
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Image
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci**Since**: 10
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci**Related module**: [Image](image.md)
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci## Summary
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci### Structs
23e41f4b71Sopenharmony_ci
24e41f4b71Sopenharmony_ci| Name| Description| 
25e41f4b71Sopenharmony_ci| -------- | -------- |
26e41f4b71Sopenharmony_ci| struct  [OhosImageRegion](_ohos_image_region.md) | Defines the region of an image source to decode. | 
27e41f4b71Sopenharmony_ci| struct  [OhosImageSourceOps](_ohos_image_source_ops.md) | Defines the image source options.  | 
28e41f4b71Sopenharmony_ci| struct  [OhosImageDecodingOps](_ohos_image_decoding_ops.md) | Defines the options for decoding an image source. | 
29e41f4b71Sopenharmony_ci| struct  [OhosImageSourceInfo](_ohos_image_source_info.md) | Defines the information about an image source. | 
30e41f4b71Sopenharmony_ci| struct  [OhosImageSource](_ohos_image_source.md) | Defines the input resource of an image source. Only one type of resource is accepted at a time. | 
31e41f4b71Sopenharmony_ci| struct  [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md) | Defines the delay time list of an image source. | 
32e41f4b71Sopenharmony_ci| struct  [OhosImageSourceSupportedFormat](_ohos_image_source_supported_format.md) | Defines the format string supported by an image source.  | 
33e41f4b71Sopenharmony_ci| struct  [OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md) | Defines the format string list supported by an image source.  | 
34e41f4b71Sopenharmony_ci| struct  [OhosImageSourceProperty](_ohos_image_source_property.md) | Defines the property string (in key-value format) of an image source.  | 
35e41f4b71Sopenharmony_ci| struct  [OhosImageSourceUpdateData](_ohos_image_source_update_data.md) | Defines the update data of an image source. | 
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci### Types
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci| Name| Description| 
41e41f4b71Sopenharmony_ci| -------- | -------- |
42e41f4b71Sopenharmony_ci| typedef struct ImageSourceNative_ [ImageSourceNative](image.md#imagesourcenative) | Defines an image source object at the native layer. | 
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci### Functions
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci| Name| Description| 
48e41f4b71Sopenharmony_ci| -------- | -------- |
49e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_Create](image.md#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. | 
50e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_CreateFromUri](image.md#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. | 
51e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_CreateFromFd](image.md#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. | 
52e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_CreateFromData](image.md#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. | 
53e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_CreateFromRawFile](image.md#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. | 
54e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_CreateIncremental](image.md#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.| 
55e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_CreateIncrementalFromData](image.md#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**.  | 
56e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_GetSupportedFormats](image.md#oh_imagesource_getsupportedformats) (struct [OhosImageSourceSupportedFormatList](_ohos_image_source_supported_format_list.md) \*res) | Obtains all supported decoding formats. | 
57e41f4b71Sopenharmony_ci| [ImageSourceNative](image.md#imagesourcenative) \* [OH_ImageSource_InitNative](image.md#oh_imagesource_initnative) (napi_env env, napi_value source) | Converts an **ImageSource** object at the JavaScript native layer into an [ImageSourceNative](image.md#imagesourcenative) object. | 
58e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_CreatePixelMap](image.md#oh_imagesource_createpixelmap) (const [ImageSourceNative](image.md#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. | 
59e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_CreatePixelMapList](image.md#oh_imagesource_createpixelmaplist) (const [ImageSourceNative](image.md#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. | 
60e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_GetDelayTime](image.md#oh_imagesource_getdelaytime) (const [ImageSourceNative](image.md#imagesourcenative) \*native, struct [OhosImageSourceDelayTimeList](_ohos_image_source_delay_time_list.md) \*res) | Obtains the delay time list from an **ImageSource** object (such as GIF or WEBP image source).| 
61e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_GetFrameCount](image.md#oh_imagesource_getframecount) (const [ImageSourceNative](image.md#imagesourcenative) \*native, uint32_t \*res) | Obtains the number of frames from an **ImageSourceNative** object. | 
62e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_GetImageInfo](image.md#oh_imagesource_getimageinfo) (const [ImageSourceNative](image.md#imagesourcenative) \*native, int32_t index, struct [OhosImageSourceInfo](_ohos_image_source_info.md) \*info) | Obtains image source information from an **ImageSourceNative** object by index. | 
63e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_GetImageProperty](image.md#oh_imagesource_getimageproperty) (const [ImageSourceNative](image.md#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. | 
64e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_ModifyImageProperty](image.md#oh_imagesource_modifyimageproperty) (const [ImageSourceNative](image.md#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. | 
65e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_UpdateData](image.md#oh_imagesource_updatedata) (const [ImageSourceNative](image.md#imagesourcenative) \*native, struct [OhosImageSourceUpdateData](_ohos_image_source_update_data.md) \*data) | Updates the data of an **ImageSourceNative** object. | 
66e41f4b71Sopenharmony_ci| int32_t [OH_ImageSource_Release](image.md#oh_imagesource_release) ([ImageSourceNative](image.md#imagesourcenative) \*native) | Releases an **ImageSourceNative** object. | 
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci### Variables
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci| Name| Description| 
72e41f4b71Sopenharmony_ci| -------- | -------- |
73e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_BITS_PER_SAMPLE](image.md#ohos_image_property_bits_per_sample) = "BitsPerSample" | Defines a pointer to bits per sample, one of the image properties.  | 
74e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_ORIENTATION](image.md#ohos_image_property_orientation) = "Orientation" | Defines a pointer to the orientation, one of the image properties. | 
75e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_IMAGE_LENGTH](image.md#ohos_image_property_image_length) = "ImageLength" | Defines a pointer to the image length, one of the image properties. | 
76e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_IMAGE_WIDTH](image.md#ohos_image_property_image_width) = "ImageWidth" | Defines a pointer to the image width, one of the image properties.  | 
77e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_GPS_LATITUDE](image.md#ohos_image_property_gps_latitude) = "GPSLatitude" | Defines a pointer to the GPS latitude, one of the image properties.  | 
78e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_GPS_LONGITUDE](image.md#ohos_image_property_gps_longitude) = "GPSLongitude" | Defines a pointer to the GPS longitude, one of the image properties. | 
79e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_GPS_LATITUDE_REF](image.md#ohos_image_property_gps_latitude_ref) = "GPSLatitudeRef" | Defines a pointer to the GPS latitude reference information, one of the image properties. | 
80e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_GPS_LONGITUDE_REF](image.md#ohos_image_property_gps_longitude_ref) = "GPSLongitudeRef" | Defines a pointer to the GPS longitude reference information, one of the image properties.  | 
81e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_DATE_TIME_ORIGINAL](image.md#ohos_image_property_date_time_original) = "DateTimeOriginal" | Defines a pointer to the created date and time, one of the image properties.  | 
82e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_EXPOSURE_TIME](image.md#ohos_image_property_exposure_time) = "ExposureTime" | Defines a pointer to the exposure time, one of the image properties.  | 
83e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_SCENE_TYPE](image.md#ohos_image_property_scene_type) = "SceneType" | Defines a pointer to the scene type, one of the image properties.  | 
84e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_ISO_SPEED_RATINGS](image.md#ohos_image_property_iso_speed_ratings) = "ISOSpeedRatings" | Defines a pointer to the ISO speed ratings, one of the image properties.  | 
85e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_F_NUMBER](image.md#ohos_image_property_f_number) = "FNumber" | Defines a pointer to the f-number of the image, one of the image properties.  | 
86e41f4b71Sopenharmony_ci| const char \* [OHOS_IMAGE_PROPERTY_COMPRESSED_BITS_PER_PIXEL](image.md#ohos_image_property_compressed_bits_per_pixel) = "CompressedBitsPerPixel" | Defines a pointer to the compressed bits per pixel, one of the image properties.  | 
87