Image Kit provides APIs for you to decode, encode, edit, and receive images, and to process image metadata.
Be familiar with the following basic concepts before development:
A PixelMap object. It can be used to read or write pixel data and perform operations such as cropping, scaling, translation, rotation, and mirroring. It can also be directly passed to the Image component for display. It also provides methods for obtaining image information and obtaining and setting the color gamut and HDR metadata of images.
A multi-picture object. It contains a main picture, auxiliary pictures, and metadata. The main picture contains the primary image information. The auxiliary pictures store additional information related to the main picture. The metadata stores other information related to the image. Picture provides methods to obtain the main picture, compose HDR images, obtain and set auxiliary pictures, and obtain and set metadata.
Image decoding
The operation of decoding a supported image file into a PixelMap or Picture for image display or processing in applications or the system.
Image editing and processing
A series of operations performed on a PixelMap, such as rotation, scaling, opacity setting, obtaining image information, and reading and writing pixel data. The origin of the coordinate system is the upper left corner.
Image encoding
The operation of encoding a PixelMap or Picture into an image file in a different format for subsequent processing, such as storage and transmission.
Image Kit provides rich image processing capabilities that developers can use flexibly as needed. You can either use the complete workflow of image decoding, editing and processing, and encoding, or directly pass the decoded PixelMap to the Image component for display without further processing. Rich option parameters are available during decoding and encoding to meet the requirements of various development scenarios.
Image Kit supports PixelMap operations on the decoded PixelMap to process part of the target image. It also supports image transformations, allowing you to crop, scale, offset, rotate, flip, and set the opacity for an image.
Image Kit supports adding filter effects to images through ImageEffect.
Image Kit also provides the capability to read and edit image EXIF data. You can obtain and configure additional attributes in image files, such as basic image information like width, height, and rotation direction, photography parameters like aperture and focal length, and GPS information like longitude and latitude.
The image decoding and encoding processes are shown in Figure 1 and Figure 2. The PixelMap obtained after decoding can be directly used for image display, editing, and processing.
Figure 1 Image decoding process

Figure 2 Image encoding process

Read and write permission constraints
During image processing, applications may need to use user images. To ensure normal function running, the application needs to request the corresponding read and write permissions from the user. For details, see Requesting User Authorization.
Selecting appropriate C APIs
Image Kit currently provides two sets of C APIs: C APIs dependent on JS objects (Image) and C APIs independent of JS objects (Image_NativeModule).
C APIs dependent on JS objects
These APIs can be used to perform image encoding and decoding, image receiving, and image data processing. For example code, see Using Image to Decode Images (C/C++). You can also check the C APIs under Image to confirm the API scope. These APIs were released before API version 11, and no new features will be added in later versions. Therefore, they are not recommended.
C APIs independent of JS objects
In addition to providing the basic image framework capabilities described above, these APIs also support new features such as multi-picture encoding and decoding. For the development guide, see Using Image_NativeModule to Decode Images. You can also check the C APIs under Image_NativeModule to confirm the API scope. These APIs have been supported since API version 12 and will continue to evolve. Developers are recommended to use them.
Using both sets of C APIs together is not recommended, because they are incompatible in some scenarios.
This kit supports the Emulator, but there are some differences in feature support between real devices and the Emulator: