This is done using e4e+StyleCLIP (more info and tutorial here: https://www.youtube.com/watch?v=g-vm_oCHWN8). I was curious how it would handle the portraits in JA2, and the results are generally very impressive. There are some characters it didn't get quite right, and it especially struggled with characters wearing glasses, but I think most of the results look very good, especially since the artwork is so low resolution.
Here's a collection of every portrait from the game re-created using the AI program for those who want to see the entire collection, or maybe for JA2 modding purposes: https://mega.nz/file/EM9BzSrT#c5NpXPpfrZHo2fiKkNVzhI7DtQhrlTZRGMdQlzgHDro