[Help wanted:] How to add portraits to NPCs

Hello dear community,
I have the following problem: I know there exist portrait packs which add portraits to most (all?) of the NPCs in Baldurs Gate EE (and Baldurs Gate 2 EE). Now I'd like to use different portraits, and I know how to add / change a portrait via NearInfinity. Although, over the years now I have a few 100 portraits added manually. The problem: when I want to reinstall Baldurs Gate (for new mods, updated already installed mods, new computer), all the manually installed portraits would be gone.
How would I go about writing a mod which automatically adds my custom portraits to the NPCs? I'm a total noob considering programming / writing scripts, and I already tried to figure out what did the Portraits, Portraits Everywhere mod, but I honestly have no idea how they did it or what I would have to change to insert my own pictures.
How do I tell a mod that it has to search for a creature and add a portrait / replace an existing portrait with a different one?
I have the following problem: I know there exist portrait packs which add portraits to most (all?) of the NPCs in Baldurs Gate EE (and Baldurs Gate 2 EE). Now I'd like to use different portraits, and I know how to add / change a portrait via NearInfinity. Although, over the years now I have a few 100 portraits added manually. The problem: when I want to reinstall Baldurs Gate (for new mods, updated already installed mods, new computer), all the manually installed portraits would be gone.
How would I go about writing a mod which automatically adds my custom portraits to the NPCs? I'm a total noob considering programming / writing scripts, and I already tried to figure out what did the Portraits, Portraits Everywhere mod, but I honestly have no idea how they did it or what I would have to change to insert my own pictures.
How do I tell a mod that it has to search for a creature and add a portrait / replace an existing portrait with a different one?
0