The **EffectKit** module provides basic image processing capabilities, including brightness adjustment, blurring, grayscale adjustment, and color picker.
This module provides the following classes:
-[Filter](#filter): a class that provides the effect chain.
-[Color](#color): a class used to store the color picked.
-[ColorPicker](#colorpicker): a smart color picker.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
importeffectKitfrom'@ohos.effectKit';
```
## effectKit.createEffect
createEffect(source: image.PixelMap): Filter
Creates a **Filter** instance based on the pixel map.
| red | number | Yes | No | Value of the red component. |
| green | number | Yes | No | Value of the green component. |
| blue | number | Yes | No | Value of the blue component. |
| alpha | number | Yes | No | Value of the alpha component. |
## ColorPicker
A class used to obtain the main color of an image from its data. Before calling any method of **ColorPicker**, use [createColorPicker](#effectkitcreatecolorpicker) to create a **ColorPicker** instance.
### getMainColor
getMainColor(): Promise\<Color>
Obtains the main color of the image and writes the result to a **[Color](#color)** instance. This API uses a promise to return the result.
| [Color](#color) | Color value of the main color. If the operation fails, **null** is returned.|
**Example**
```js
letcolor=colorPicker.getMainColorSync();
console.log('get main color ='+color);
```
## Filter
A class used to add a specified effect to an image. Before calling any method of **Filter**, use [createEffect](#effectkitcreateeffect) to create a **Filter** instance.
### blur
blur(radius: number): Filter
Adds the blur effect to the filter linked list, and returns the head node of the linked list.
| radius | number | Yes | Blur radius, in pixels. The blur effect is proportional to the configured value. A larger value indicates a more obvious effect.|