• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Interface (QuickImageDataHandler)
2
3> **NOTE**
4>
5> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
6> - The initial APIs of this interface are supported since API version 13.
7
8QuickImageDataHandler is a media asset handler used to customize the media asset processing logic in **onDataPrepared**.
9
10**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
11
12## Modules to Import
13
14```ts
15import { photoAccessHelper } from '@kit.MediaLibraryKit';
16```
17
18## onDataPrepared<sup>13+</sup>
19
20onDataPrepared(data: T, imageSource: image.ImageSource, map: Map<string, string>): void
21
22Called when the requested image is ready. If an error occurs, **data** returned by the callback is **undefined**.
23
24Information returned by **map**:
25
26| Map Key | **Description**|
27|----------|-------|
28| 'quality'  | Image quality. The value **high** means high quality, and **low** means poor quality.|
29
30**System capability**: SystemCapability.FileManagement.PhotoAccessHelper.Core
31
32**Parameters**
33
34| Name | Type| Mandatory| Description                                                                           |
35|------|---| ---- |-------------------------------------------------------------------------------|
36| data | T | Yes  | Data of the image asset that is ready. It is of the generic type and supports the [Picture](../apis-image-kit/arkts-apis-image-Picture.md) type.|
37| imageSource | image.ImageSource | Yes  | Data of the image asset that is ready.|
38| map<sup>13+</sup> | Map<string, string> | Yes  | Additional information about the image asset, such as the image quality. Currently, only **quality** is supported.|
39
40**Example**
41
42```ts
43import { image } from '@kit.ImageKit';
44
45class MediaHandler implements photoAccessHelper.QuickImageDataHandler<image.Picture> {
46  onDataPrepared(data: image.Picture, imageSource: image.ImageSource, map: Map<string, string>) {
47    console.info('on image data prepared');
48  }
49}
50```
51