typedef struct OH_ImagePackerNative OH_ImagePackerNative
OH_ImagePackerNative is used to encode an ImageSource, PixelMap, Picture, or PixelMap sequence into image data or a file.
Use the OH_ImagePackerNative_Create function to create an OH_ImagePackerNative object.
Use the OH_ImagePackerNative_Release function to release an OH_ImagePackerNative object.
Resource management: After OH_ImagePackerNative is used, call OH_ImagePackerNative_Release to release it. Releasing an OH_ImagePackerNative object does not release the OH_PackingOptions, OH_PackingOptionsForSequence, OH_ImageSourceNative, OH_PixelmapNative, or OH_PictureNative object.
The encoding methods supported by OH_ImagePackerNative are as follows.
| Input Object | Output Location | Encoding Function | Description |
|---|---|---|---|
| OH_ImageSourceNative | Data buffer | OH_ImagePackerNative_PackToDataFromImageSource | Encodes an ImageSource to data in the specified format. |
| OH_PixelmapNative | Data buffer | OH_ImagePackerNative_PackToDataFromPixelmap | Encodes a PixelMap to data in the specified format. |
| OH_PictureNative | Data buffer | OH_ImagePackerNative_PackToDataFromPicture | Encodes a Picture to data in the specified format. Only JPEG and HEIF are supported. |
| OH_PixelmapNative array | Data buffer | OH_ImagePackerNative_PackToDataFromPixelmapSequence | Encodes a PixelMap sequence to data in GIF format. |
| OH_ImageSourceNative | File descriptor | OH_ImagePackerNative_PackToFileFromImageSource | Encodes an ImageSource to a file. |
| OH_PixelmapNative | File descriptor | OH_ImagePackerNative_PackToFileFromPixelmap | Encodes a PixelMap to a file. |
| OH_PictureNative | File descriptor | OH_ImagePackerNative_PackToFileFromPicture | Encodes a Picture to a file. Only JPEG and HEIF are supported. |
| OH_PixelmapNative array | File descriptor | OH_ImagePackerNative_PackToFileFromPixelmapSequence | Encodes a PixelMap sequence to GIF format and writes it to a file. |
To obtain the image formats supported for encoding, use the OH_ImagePackerNative_GetSupportedFormats function.
Since: 12
Related module: Image_NativeModule
Header file: image_packer_native.h