StyleGAN2 is very powerful. The project facemorph is based on it, and there is an API for the website. Here I show an example how to use the API from R, which is basically based on {httr} pacakge.
library(httr)
api_url <- "https://api.facemorph.me/api/encodeimage/"
resp <- POST(
api_url,
body = list(
tryalign = TRUE,
usrimg = upload_file("path/")
),
encode = "multipart"
)