How to make a picture in black and white?

I made a picture

lv_obj_t *image = lv_img_create(panel);
lv_img_set_src(image, home_icon);

The icon is colored. Can I make the icon black and white (in grayscale), and then make it color again, as it was? Is there a functional in LVGL that allows you to change the palette of a picture from color to black and white and back?

You can do it in a loop by all pixels of you icon and make new 8 bit gray IMG by formula gray = 0.3 * R + 0.59 * G + 0.11 * B

That is, you need to make a copy home_icon - home_icon_BlackWhite
In this copy, change the color
then LV_IMG_DECLARE(home_icon_BlackWhite);
and then set black&white by

lv_img_set_src(image, home_icon_BlackWhite);

or set color by

lv_img_set_src(image, home_icon);

Did I understand you correctly?