Skip to main content
Language

From Resources

PhotoEditor SDK supports adding custom filters from the resources. In this example, we add custom LUT and duotone filters.

WARNING: Be sure to put the drawables for the filters in the res/drawable-nodpi folder. Otherwise, they will be scaled by the Android system.

LUT and Duotone Filters#

For the custom LUT filter to invert the photo colors we construct a LutColorFilterAsset object providing the local resource drawable. The duotone filter, additionally, requires passing the light and dark color of the filter.

Add filters to AssetConfig#

To use the filters, they must first be available in the SDK's backend. This is done by adding the filters to the AssetConfig.

Create filter group#

In cases where we want to simplify navigation and discovery, we can group sets of related filters that will appear in a single folder in the filter tool.

Create a FolderItem passing a unique identifier, a display name for the group and a thumbnail for the group folder.

Configure UiConfigFilter#

Here, we configure UiConfigFilter and add the custom FolderItem we created above to the filterList. Alternatively, we could have directly added the FilterItems to the filterList without creating a folder.