msrd0 / rlottie-rs

Rust bindings to rlottie and file conversion library and tools
MIT License
17 stars 4 forks source link

Telegram skin recolor #30

Open yuraiz opened 2 years ago

yuraiz commented 2 years ago

Telegram can recolor some animations to different skin colors image

but it's telegram's rlottie only feature https://github.com/TelegramMessenger/rlottie/commit/67f103bc8b625f2a4a9e94f1d8c7bd84c5a08d1d

If I understand correctly I need to implement capi in optional file and add feature to use it

msrd0 commented 2 years ago

No, the C API isn't going to help you. The changes you linked to are only made to the C++ interface, the C interface is just a binding to that.

yuraiz commented 2 years ago

Looks like bindgen generate binding to C++: https://rust-lang.github.io/rust-bindgen/cpp.html

maybe I can make hpp wrapper and add load_from_data_tg function

msrd0 commented 2 years ago

Yeah I see basically 3 options:

Feel free to try these out and/or suggest other options that I might've missed. The last one might be favourable as it would work with either version of rlottie.

yuraiz commented 2 years ago

I made first working version image https://github.com/yuraiz/rlottie-rs/tree/fitz-recolor

msrd0 commented 2 years ago

It looks like this should work with Samsung version of rlottie too (https://github.com/Samsung/rlottie/commit/3be663ef40122aca6c748e91f060e6b15637bdb5), but with a different api.

yuraiz commented 2 years ago

Telegram's fitzModifier gets replacement colors from json, and recolors skin only when Samsung's colorFilter will be applied to all colors

yuraiz commented 2 years ago

Color filter can be useful for conversion, but I don't want to use it for skin recolor

yuraiz commented 2 years ago

I can make feature 'v2' and add color filter later, but 'v2' and 'tg' features will be exclusive

yuraiz commented 2 years ago

Telegram used to apply skin tone to faces Screenshot_20221028-070312_Telegram