X
Innovation
Why you can trust ZDNET : ZDNET independently tests and researches products to bring you our best recommendations and advice. When you buy through our links, we may earn a commission. Our process

'ZDNET Recommends': What exactly does it mean?

ZDNET's recommendations are based on many hours of testing, research, and comparison shopping. We gather data from the best available sources, including vendor and retailer listings as well as other relevant and independent reviews sites. And we pore over customer reviews to find out what matters to real people who already own and use the products and services we’re assessing.

When you click through from our site to a retailer and buy a product or service, we may earn affiliate commissions. This helps support our work, but does not affect what we cover or how, and it does not affect the price you pay. Neither ZDNET nor the author are compensated for these independent reviews. Indeed, we follow strict guidelines that ensure our editorial content is never influenced by advertisers.

ZDNET's editorial team writes on behalf of you, our reader. Our goal is to deliver the most accurate information and the most knowledgeable advice possible in order to help you make smarter buying decisions on tech gear and a wide array of products and services. Our editors thoroughly review and fact-check every article to ensure that our content meets the highest standards. If we have made an error or published misleading information, we will correct or clarify the article. If you see inaccuracies in our content, please report the mistake via this form.

Close

How to get a perfect face swap using Midjourney AI

Looking to create realistic, consistent characters with AI image tools? We can show you how.
Written by David Gewirtz, Senior Contributing Editor
AI image

This is the final image we'll be working to create.

David Gewirtz via Midjourney/ZDNET

Image generation using AIs like Midjourney is shockingly good. But the AIs also have a few weaknesses. In this article, I'll show you how you can work around one of those weaknesses.

We're going to learn how to make two or more characters with matching faces. 

Also: AI in 2023: A year of breakthroughs that left no human thing unchanged

Face matching is surprisingly inconsistent, and there are a few different techniques that can be used. When I created my music promotion poses, I had to use some special techniques to get the graphics to work.

How we use Midjourney, InsightFace, and Adobe Generative Fill to create this look

In my recent article about using AI to create an album, I glossed over the techniques I used, giving a thousand-foot view of what they were. But in this article, I'm going to dive in and show you how to make it all happen, step by step.

Also, for this article, I'm going to assume you've signed up for and set up your Midjourney account. If you're not sure how to do that, this article by ZDNET's Lance Whitney will walk you through the steps:

Also: How to use Midjourney to generate amazing images and art

First, I'll show you what I did to create my images, and then I'll show you some additional techniques.

1. Use a starter image

This technique uses an existing photograph as part of the image prompt, which gives Midjourney some guidance on what to create. Since I wanted my main album promotion images to look like me, I gave Midjourney a starter image.

To do this, double-click on the plus icon at the bottom of the Discord screen (remember, Midjourney runs in Discord), choose your image, and then hit return.

David Gewirtz in an image
Screenshot by David Gewirtz/ZDNET

Once it's been brought into Midjourney, right click on the image and select Copy Link:

Copy Link button
Screenshot by David Gewirtz/ZDNET

This link is what you'll use in preparing your prompt. Next, give Midjourney the /IMAGINE prompt, followed by the URL, and then your spec. This screenshot of the set of four generated images shows what it looked like after I entered the full prompt. The top left picture is the image I wound up using for my profile. 

AI image of David Gewirtz
David Gewirtz via Midjourney/ZDNET

Please note that this set of images was most definitely not my first "roll" on Midjourney. Expect to do five, 10, even 20 different tries before you get something you like.

Also: 5 ways to explore the use of generative AI at work

That said, you can see how the generated version (especially the one on the upper left) looks reasonably close to what I look like. More interestingly, the leather jacket in the image looks weirdly like the one I've been wearing for the past decade or so. How does it know?

Just for completionist's sake, here's what might have been generated without using the uploaded image as guidance.

AI image of man with beard

Definitely not me, but I think I went to engineering school with the guy on the lower right!

David Gewirtz via Midjourney/ZDNET

They're all fine-looking gentlemen, but they look nothing like me.

You can use the starter-image trick for anything you want. Here's what Midjourney thinks my little Yorkie Poo pup Pixel might have looked like as a Scottish warrior prince:

AI image of a dog and human
David Gewirtz via Midjourney/ZDNET

2. Get a seed ID

Each quad of images generated by Midjourney has its own ID, called a seed. If you want to create future images that are similar to an existing Midjourney image, you can try referencing the seed ID. It doesn't always work, but it's worth a try.

envelop
Screenshot by David Gewirtz/ZDNET

To get a seed ID, click the half-moon-plus icon (1) at the upper right of the image where you want to get the seed. Then, in the search box, type in :envelope: (2). Then click on the envelope (3).

Also: I asked DALL-E 3 to create a portrait of every US state, and the results were gloriously strange

I know it's completely intuitively unobvious, but this process will convince Midjourney to send you a message that contains the seed ID for the quad of images you're working with.

AI image of David Gewirtz
David Gewirtz via Midjourney/ZDNET

It's unfortunate that the seed is for the quad of images, because that makes it harder to drill into the one image you like. But it's a starting point.

3. Create a second image

For my promotion, I wanted an image of me standing in front of my car. I drive a red Dodge Challenger and I thought that would be cool for my bio page.

This time, instead of starting with the actual photo of me, I used the generated profile image as my starting point. As shown above, I uploaded it and got its URL.

AI image of David Gewirtz
David Gewirtz via Midjourney/ZDNET

Then, I combined the profile image with the previously retrieved seed value and a prompt, and after about 20 spins, I got this quad:

AI images of David Gewirtz
David Gewirtz via Midjourney/ZDNET

Notice the /imagine prompt. The URL is at the beginning, and the seed prompt at the end had my seed number. That's how I tied the two images together.

Also: The best AI art generators: DALL-E 2 and fun alternatives to try

While the image on the lower left was absolutely terrible, the one on the right wasn't bad. Strictly speaking, it didn't look entirely like me. But it did capture the same thematic style as the original profile image, it was close enough, and the car looked good.

But this was not my face and most definitely not my hair:

AI image of man with a beard
David Gewirtz via Midjourney/ZDNET

4. Swap faces

To get the faces right, I used a tool called InsightFace, which also runs in Discord. Getting InsightFace set up is its own project, and rather than taking you down that rabbit hole here, I'll point you to the tutorial I used to get started.

This video is from PIXimperfect. I really like this channel because the presenter showcases some excellent image tutorials, particular on Photoshop features. So, don't just watch the video -- save the channel.

Also: Can DALL-E 3 in ChatGPT read and modify images? Come see for yourself

Once you have InsightFace set up, we can go to town. The process involves two steps: uploading the face you want to use, and uploading the image you want it applied to.

To upload the image you want to use, use the /saveid command.

David Gewirtz in an image
Screenshot by David Gewirtz/ZDNET

When you type /saveid, you'll be given a place to upload an image. Then you need to give that image a name ID. I called mine "daviddoor" because I'm standing in front of a door. Remember that ID because you'll use it in the next step.

Now, it's time for the face swap. Type /swapid:

AI image of David Gewirtz
David Gewirtz via Midjourney/ZDNET

Upload the image you want the face to be applied to. Then type in the ID you created earlier. If you're lucky, once you hit return, you'll get an image with the new face.

AI images of two men with beards
David Gewirtz via Midjourney/ZDNET

Of course, the hair still isn't right.

5. Fix the hair

Finally, I needed to fix the hair. For this, I dropped into the Adobe Photoshop beta and used Generative Fill. Midjourney is great for creating entire images. Photoshop Generative Fill is ideal for placing new imagery on top of existing images and having it all bend together seamlessly.

AI images of three men

Various versions of me, both with and without hair.

David Gewirtz via Midjourney/ZDNET

The key problem was all the extra hair below the ears. To eliminate that, I first brought the Dave Head to something nobody had ever seen before: a bald me. I selected the space just where I wanted the hair removed, generated "bald", and Photoshop did the work.

Then I selected a smaller area and generated "curly hair". This took a few tries, but it worked out.

Also: How to use Bing Image Creator (and why it's better than DALL-E 2)

And, after all the various AI effects, the final picture is below. 

One quick note: the hair here doesn't quite match the tutorial hair above. That's because I had to recreate the process for demonstration, and the AI always comes up with something slightly different. This is the actual final image from my original production process, but the rightmost image in the Three Daves graphic above shows how new hair could be generated, even if it's not exactly the same output.

AI image of David Gewirtz
David Gewirtz via Midjourney/ZDNET

FAQs

Here are a few questions I've been asked since I published the original article.

Can I still use Midjourney for free? 

No. Midjourney no longer has a free tier. The plan I use costs $8 per month. So far, I haven't hit any limits with it, although it sometimes can take a little while for images to be created.

What about InsightFace? Is it free? 

InsightFace does offer some free credits. I've done four or five face swaps and haven't used them up. It appears to take about three "credits" per face swap, and you get 50 free credits.

Where does Picsi.ai fit into all this? 

So, when you run out of face swap credits, you'll need to subscribe to a Patreon account for Picsi.ai. There are two plans. The base $10 per month plan looks like it will do fine for most people. As to the relationship between InsightFace and Picsi.ai, it appears that InsightFace is an open-source project, and Picsi.ai has created a usable Discord client for it. But I'm sure more will be revealed over time.

Have you used any of these AI image tools? What do you think of the face swap technique? Does this spark any ideas for you? Let us know in the comments below.

Disclaimer: You should consider the legal consequences (e.g. copyright) of using AI-generated images before implementing them into your work.   


You can follow my day-to-day project updates on social media. Be sure to subscribe to my weekly update newsletter on Substack, and follow me on Twitter at @DavidGewirtz, on Facebook at Facebook.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, and on YouTube at YouTube.com/DavidGewirtzTV.

Editorial standards