Thursday, August 16, 2012

The Face Swap

This is one of the most requested kind of chops I have seen, and here's how to do it the easy way! Keep in mind this is a beginner level tutorial so if it feels kind of slow, that's because it is.

This is a chilled remix of a 90's electronic classic, the soothing tones will get you through the frustration while creating a new-found sense of wonder at what you're creating (in theory)

Before we begin, here are my rules to live by when face swapping (or most chops for that matter)
      1. Match resolutions - a lo-res face will look terrible on a hi-res head, it's just fact. You can always shrink the higher resolution to match the lower, but more often than not you will want as high of a resolution from both sides as possible.
      2. Match lighting - if your head is on the beach while your face is at a seedy bar, the chances are that despite retouching (utilizing photoshop to alter an image) them very well your final image will still look unnatural.
      3. Match angles - your faces must have a similar orientation! While facebook has transform tools to flip, warp, and distort images, chances are that you, the user, won't be able to fully match the face to head (not even I can do this).

After reading these rules, you are probably realizing that half the battle is finding two compatible images. The beauty of this, however, is that the more compatible they are, the easier to combine and better looking they will be in the end!

Step 1: Finding our images
Right now, Nic Cage is all the rage, and since we share a first name I will choose his face. Namely this image: Good luck not getting lost in these eyes
Another relatively popular subject is the London 2012 Olympic games, and who better to represent them than her majesty herself: Yeah, I'd do it
Notice both hi-res, well-lit, and head-on images. This should be cake!

Step 2: Opening your file
I first copied the picture of the queen and opened photoshop. I then selected new (Ctrl+N or Command+N), and the following box appeared

 New image menu

Notice it is already set to match the resolution of the source image. To fit both images, I simply will double the width from 1634 to 3200. This is also an opportunity to name your image, I chose 'Queen of Cage'. I would also suggest setting background contents to 'Transparent' to make things more user-friendly. Select 'OK'.

 Step 3: Adding your images
Proceed to past the first image onto the canvas via Edit>Paste or Ctrl+V/Command+V. Once it's there, select the Transform tool (should be in the top left of the toolbar along the left edge of your screen) or press Ctrl+T/Command+T for quick access and drag the image to touch the right hand of the canvas (giant checkered box she's already on). I would then suggest renaming the layer in the layer window (which you will find on the bottom right of your screen) by double-clicking where it says 'Layer 1' (I renamed mine to Queen).
Layout diagram

Copy and paste the Nic Cage picture and drag it just as you did the Queen picture so they are now side by side (as shown
 Side by side

If you notice, you may say that I violated my first rule of match resolutions, but this is more than adequate. We will just simply resize the queen to match the lower-res Cage. 

Learning time: The layer window

1. Link - links layers so that transforming one will also transform the other

2. Layer style - adds cheap effects to the current layer

3. Mask - hides parts of a layer without altering the image

4. Adjustment layer - Creates a layer to adjust the properties of the layers underneath it

5. Group - Puts selected layers into a folder

6. New layer - Creates a new layer

7. Trash can - Deletes a selected layer

Step 4: Grouping
Personally I like to duplicate the layer every time I alter an image to preserve the last state. To keep things clean and organized, select the 'Queen' layer in the layer window and click the Group button or press Ctrl+G/Command+G. This will create a folder named 'Group 1'. Rename the folder just like you would a layer to 'Queen'. This creates an easy way to keep all your layers of an image together. I usually rename the first layer ('Queen' in this case) to 'Original'. You will know if your image is in the folder if when you click the arrow to the left of the folder the layer is hidden, this makes it easier for you to keep your layer window clear of clutter. You may do the same thing to the 'Cage' layer if you wish.

Step 5: Matching sizes
Select the 'Original' queen layer and either right click and select duplicate layer or simply drag the layer onto the New layer button. This will create a layer above the 'Original layer'
 called 'Original copy'. Rename it 'Resized' and hide the 'Original' layer by clicking the eye to the left of it (so you don't get distracted). Select this layer and press Ctrl+T/Command+T to enable transforming/resizing. If you do this right you should notice that your image has developed eight boxes along the perimeter and a tiny dotted circle in the middle. To resize the image you have two options, hold the shift while dragging a corner inward, or hold both the shift+alt keys while dragging a corner inward to shrink the image even quicker. Do this until the queen's head is the almost the same size as Cage's. I usually shrink the image a bit, drag it close, and shrink it again just to have a closer approximation. After this is done, move the 'Cage' group below the 'Queen' group by simply dragging and dropping one folder underneath the other in the Layer window
 

Step 6: Space for Cage
Once it's properly sized you may want to shrink your canvas by cropping it. Do this by selecting the Crop tool (four down from the transform tool and pictured selected to the right). Simply drag the corners towards the edges of the images until it resembles the canvas size of the previous image from Step 5. Now to make a space for Cage's face on the queen! Duplicate the queen's 'Resized' layer and name it 'Masked'. Again, hide the layer below to avoid confusion! Once it is renamed, select it and click the Mask button in the layer menu. You'll notice that a white box has appeared to the right of it in the layer window, this is the mask.

Learning time: A mask
A mask is a map of what parts of an image you want. It uses shades of black and white to determine where and how much of the image you want on the canvas. THIS DOES NOT DELETE THE IMAGE AND IS COMPLETELY REVERSABLE.  White tells photoshop to keep this part, while black says to not show it.

Step 6: Space for Cage (continued)
Now to clear a space for Cage's face. Select the Brush tool (three below the crop tool and pictured selected below). 
Brush menu

We'll need to adjust the brush size and hardness to better blend with Cage. Do this by selecting the brush properties menu located just under the taskbar and above the toolbar (pictured above). You will want to set the hardness to 0% and the size to 40px for this instance. Make sure the Brush color is set to black, you'll see this near the bottom of the toolbar with the two colored overlapping blocks (not the ones on the very bottom). If white is on top simply click the switch arrow right above the blocks to swap to black. Select the mask of the 'Masked' layer and paint a hole in the queen's face. After the hole is there, drag Cage underneath and put his face in the hole. You can see the hole empty then filled below

Before and after, absolutely beautiful

Now you may crop down the image to right outside the queen image because we don't need Cage's body anymore.

Step 7: Adjustment layers
These are my ancient Chinese secret, with four adjustment layers you can match nearly any two images. Plus, they can be changed constantly whereas image adjustments are permanent. First create a group and put it between the 'Cage' and 'Queen' folders, name it 'Adjustments'. Click the Adjustment layer  button in the Layer window and choose Brightness/Contrast. A window will pop up with options for Brightness and Contrast. Drag the sliders until you find suitable values for each, the values I got were Brightness:17 and Contrast:-43. Next, choose the Levels option in the Adjustment layers menu. Tweak these values the same as you did the others, the values I got were 8, 1.12, 247, 16, 234. Now choose Hue/Saturation and repeat. Do not, however, adjust lightness, it just screws up the Brightness/Contrast. Values I got were -2, -5, 0. Finally, The Color balance, this is where you fine tune. You will have to adjust three sliders for shadows, midtones, and highlights, but it's all worth it in the end. My values: Shadows: +4, +3, +2, Midtones: 0, -2, -4, Highlights: 0, 0, +4. By now you should see one nearly flawless image.

So this is what they mean when they say breathtaking beauty...

Step 8: Transform
Now the image looks good, but something seems kind of off. We need to transform his face. Duplicate the 'Original' Cage layer and rename it 'Transformed'. To make it easier to transform just the face, we will delete the rest of his body. Use the Marquee tool (the dotted square directly underneath the Transform tool) to select a square just around his head. Then simply right click and select 'Select Inverse' or press Shift+Ctrl+I/Shift+Command+I. Once the inverse is selected simply press delete! After that, you may need to rotate his head slightly clockwise then enlarge it just a bit. You might want to nudge his head up a bit. After pressing the enter key to accept your transformation, just tap the arrow keys to move it up and to the left a bit. Now if you notice, his right cheek (your right) seems a little close. On the taskbar select Edit>Transform>Perspective, this will enable us to make his head appear angled differently. Click on the top right box of the transform square and bring it down a tiny bit, this should fist that cheek problem. To make sure your image is properly aligned, Shift+click on the layer mask (this temporarily disables the mask) to make sure the face is aligned and matched up similarly with the original subject. This one isn't particularly close, but it looks good, and that's all that matters!
Looking better miss

Step 9: Blending
Now you can obviously see the outline of his face, so we must blend! Select the brush tool again and notice the brush properties button, mode, then opacity and flow. Change flow to 2%, this will, for lack of a better phrase, "spray less paint" than it would at higher percentages. Don't forget to choose white instead of black as well! Select the Mask layer of 'Masked' again and start painting inwards from the hole. This should help our blending problem. You can also choose black and paint away the hole to match better as well

Step 10: Sharpen
Duplicate the 'Transform' Cage layer and rename is 'Sharpened'. On the taskbar go to Filter>Sharpen>Unsharp Mask. Turn the amount to full and experiment with the radius and threshold to find the right amount. Once you find good values, turn down the amount until it looks good. Values I got were 243%, 1.0, 12.



Aand you're done!! In other projects you may have to utilize shading, lighting and noise addition/reduction, but I'll do a more advance tutorial later.


An introduction

Everyone sees those funny pictures online that so seamlessly combine different sources to create a hilarious yet believable image, but most lack the ability to duplicate the quality of said images. This is where my blog will begin, the basics of creating a unique image without having a finished product that resembles a shoddy work reminiscent of MS Paint (no offense Mr. Gates).

My blog is unique in that I will show basic steps with a few simple tools that will give you the ability to duplicate most images you see to a noticeable degree. Myself, I use five or less tools or effects on ninety percent of the chops (my coolspeak for photoshop creations, it's kind of the theme of this whole thing) I make. This is the level of difficulty I'll be presenting to you, the apprentice.

Each tutorial will also be paired with a song or mix to work along to. I find that my personal work is subtly but definitely affected by the music I'm currently listening to and mood it puts me in. Feel free to join in my experience!

Good luck, and enjoy your learning!

P.S. I am new to blogs, so excuse my formatting (you can probably already tell from this aesthetically unappealing excuse for an intro). Hopefully this will be improved over time!