目录

OH_PackingOptions

typedef struct OH_PackingOptions OH_PackingOptions

Overview

OH_PackingOptions is an image encoding option struct encapsulated at the native layer. It cannot be manipulated directly; instead, functions shall be called to create and release the struct, and operate on its specific fields.

To create an OH_PackingOptions object, call OH_PackingOptions_Create.

To release an OH_PackingOptions object, call OH_PackingOptions_Release.

Usage restrictions: OH_PackingOptions is used to configure encoding parameters for ImageSource, PixelMap, or Picture.

Resource management: Releasing an OH_ImagePackerNative object does not automatically release the OH_PackingOptions object. After OH_PackingOptions is no longer needed, call OH_PackingOptions_Release to release it. Once released, it must not be passed to image encoding APIs or used with its field getter and setter functions.

The table below describes the content and operation mode of the OH_PackingOptions struct.

Field Type Field Name Field Description Field Getter Function Field Setter Function
Image_MimeType mimeType MIME type of the target encoding format. ImageSource or PixelMap encoding supports image/jpeg, image/webp, image/png, image/heic or image/heif, image/sdr_astc_4x4, image/sdr_sut_superfast_4x4, and image/hdr_astc_4x4; Picture encoding supports image/jpeg, image/heic or image/heif. The actual supported range is subject to the result returned by OH_ImagePackerNative_GetSupportedFormats. OH_PackingOptions_GetMimeType, OH_PackingOptions_GetMimeTypeWithNull OH_PackingOptions_SetMimeType
uint32_t quality Encoding quality. The actual encoding effect depends on the target encoding format. OH_PackingOptions_GetQuality OH_PackingOptions_SetQuality
bool needsPackProperties Whether to encode image properties, such as Exif. OH_PackingOptions_GetNeedsPackProperties OH_PackingOptions_SetNeedsPackProperties
int32_t desiredDynamicRange Desired image dynamic range during encoding. For details about the values, see IMAGE_PACKER_DYNAMIC_RANGE. OH_PackingOptions_GetDesiredDynamicRange OH_PackingOptions_SetDesiredDynamicRange

Since: 12

Related module: Image_NativeModule

Header file: image_packer_native.h