Module Description
The module provides capabilities for image decoding, encoding, editing, metadata processing, and image receiving.
This module contains the following classes:
-
ImageSource: provides the capabilities of obtaining image information, decoding images to PixelMaps or Pictures, and reading and modifying image properties. Supported image formats for decoding include png, jpeg, bmp, gif, webp, dng, heic12+, wbmp23+, heifs23+, and tiff23+.
-
ImagePacker: provides the capability of encoding images into compressed data streams or files. Encoding requires the ImageSource, PixelMap, or Picture of an image as the input. Supported image formats for encoding include jpeg, webp, png, heic12+, and gif18+.
-
PixelMap: contains pixel data and image information. It can be used for reading/writing pixel data and performing operations such as cropping, scaling, translating, rotating, and mirroring. It can also be directly passed to the Image component for display. Additionally, it provides APIs for obtaining and setting the color gamut and HDR metadata of images.
-
Picture: a multi-picture object composed of a main picture, auxiliary pictures, and metadata. The main picture contains the primary image information; auxiliary pictures store additional information related to the main picture; metadata stores other information related to the image. Picture provides methods for obtaining the main picture, compositing HDR images, obtaining and setting auxiliary pictures, and obtaining and setting metadata.
-
AuxiliaryPicture: used to display special information alongside the main picture, enriching the overall content of the image. The supported types of auxiliary pictures can be found in AuxiliaryPictureType.
-
Metadata: stores image metadata in key-value format. The supported metadata types can be found in MetadataType, including Exif metadata, fragment map metadata, and HEIF sequence image metadata. For details about the keys of Exif metadata, fragment map metadata, and HEIF sequence image metadata, see PropertyKey, FragmentMapPropertyKey, and HeifsPropertyKey, respectively.
-
ExifMetadata: stores Exif metadata of images in key-value format. For details about the keys of Exif metadata, see PropertyKey.
-
MakerNoteHuaweiMetadata: stores photo metadata defined by Huawei cameras in key-value format. For details about keys of HUAWEI camera-defined photo metadata, see PropertyKey.
-
HeifsMetadata: stores HEIF sequence image metadata of images in key-value format. For details about keys of HEIF sequence image metadata, see HeifsPropertyKey.
-
WebPMetadata: stores WebP image metadata in key-value format. For details about keys in WebP image metadata, see WebPPropertyKey.
-
ImageReceiver: acts as an image consumer to receive and read images from a surface.
-
ImageCreator: acts as an image producer to write images into a surface.
-
Image: used by ImageReceiver and ImageCreator for transferring image objects, with the actual content determined by the producer. For example, the image object provided by a camera preview stream contains YUV data, whereas the image object provided by a camera photo contains a JPEG file.
NOTE
The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Modules to Import
import { image } from '@kit.ImageKit';