Tuesday, May 17, 2011

How to remove spots from face in photoshop


5 Really Easy, yet Essential Photo Retouch Techniques for Photoshop Beginners

5 Really Easy, yet Essential Photo Retouch Techniques for Photoshop Beginners

In this tutorial, I will show you 5 very simple, however very important techniques for Photoshop beginners when it comes to photo retouch. You will discover how easy it is to add more contrast and depths to the image to make it look better. This tutorial is really simple but effective, Have a try!

We will take a random image and apply those 5 techniques to enhance the overall effect of the photo. Here is a summary of the five topics we will cover in this tutorial:
  1. Remove Black Spots with Spot Healing Brush
  2. Make Your Eyes Look More Obvious
  3. Use Surface Blur to Smooth Skin, instead of Gaussian Blur
  4. Make Her Lips Look Even More Delicious
  5. Add Colour Depth and Lighting Contrast to Hair
This is a before and after preview of the final result:
Before
Self_16__by_The1stGrape_stock
After
basic-photo-retouch-flatten
Ok Let’s get started!
In this tutorial, I use the following stock for demonstration purpose – Self 16. by ~The1stGrape-stock
The reason I chose this particular image is that it doesn’t look too bad from the beginning, however there are still things can be improved, perfect for beginners to get some practices on.

Remove Black Spots with Spot Healing Brush

Firstly if we take a look at the photo, we can see there are several black dots on her skin, as shown below:
1 imperfection
1 imperfection2
To fix these, we can use the Spot Healing Brush tool, as shown below in the toolbox:
1 spot healing
Simply grab the Spot Healing Brush, adjust the size of the brush to be slightly large than the black spot, and do a single-click on it:
1 spot healing 1
You can see after the single-click, the black spot disappers:
1 after spot healing
Basically, what happen is that with the Spot Healing Brush tool, it takes samples of the surrounding skin colour pixels and use them to replace the black spot colour pixel. Magical, isn’t it?
Let’s use the same method to remove all black spots on her face, here is the effect so far:
1 effect

Make Your Eyes Look More Obvious

Now let’s pay attention to her eyes, which are beautiful even without any retouching :) but, we can give them a bit more depth, here is how:
Duplicate the background layer once, set the blending mode as “Soft Light” for the duplicated layer, you will have the following effect:
2 duplicate
You can see by doing so we in fact darken the whole image. However here we only want to add depth the eyes, so we need to hide the rest of the layer. To do so, go to layer > layer mask > hide all, then on the layer mask, use a White Brush to paint inside the eyes, as shown below:
2 paint
By doing so we reveal the eyes portion of the layer only. Here is the effect after the painting:
2 effect

Use Surface Blur to Smooth Skin, instead of Gaussian Blur

Now let’s make her skin go smoother a bit. To do so, we use Surface Blur. The reason I chose Surface Blur is because unlike Gaussian Blur (which blurs the whole image), Surface Blur retains the edge details. This eliminate the needs of adding a layer mask on the duplicated layer to reveal the edges.
So let’s duplicate the orginal background layer once, and apply the following Surface Blur settings to it:
3 surf blur
Drop the opacity of the duplicated layer to around 70%, and you will have the following effect:
3 effect

Make Her Lips Look Even More Delicious

To do so, we use the Lasso Tool to make a rough selection of the lips as shown below:
4 select
Hit Ctrl + J twice to make two duplicates of the selection, change the blending mode of the first copy to “Multiply“, with 100% opacity. Change the blending mode of the second duplicated layer to “Linear Light“, with 55% opacity.
Use a soft, round eraser to gently erase the edge of the lips, you will have the following effect:
4 after blending
Add another layer on top of all other layers, grab a soft round brush with White colour, gently paint around the lower lip to add some extra light:
4 paint
Hint: set brush flow and opacity to both around 40%, this way we can gradually apply the brush effect.
4 effect

Add Colour Depth and Lighting Contrast to Hair

Lastly, we can add some more depth to this girl’s hair. To do this, we can simply add a Curves Adjustment layer with the following settings:
5 curves
Add the following layer mask to the Curves adjustment layer:
5 mask
Here is our final effect: (You can see by adding the layer mask, we leave only the hair portion highlighted)
5 effect
Optionally we add duplicate the orginal background layer and set the blending mode of the duplicated layer to “overlay”, reduce the opacity to 45%, you will have the following final effect: (click to enlarge)
basic-photo-retouch-flatten
That’s for this tutorial! Hope you enjoy it and find it useful, drop me a comment if you have any question, I will try my best to help you out.
Cheers and have a nice day!

Sunday, May 15, 2011

How to cut hair in photoshop

Handy Techniques for Cutting Out Hair in Photoshop
Read the article
When trimming out images in Photoshop, human hair or animal fur always proves troublesome and can be tricky to achieve a realistic look. Here are two techniques I use on images with both plain backgrounds, and those with a varied background tones, each achieving pretty decent end results.

Technique One: Images with Plain Backgrounds

The best photos are those professional studio type shots that are taken against a plain white background. These shots make it much easier to find the edges of the subject, but trimming out fine hairs can still be a little tricky. In this example we’ll be using the common Channel technique to trim out this lovely lady.

Open up your image in Photoshop. This particular image doesn’t have a pure white background, but it is a plain colour and has good contrast between the subject and grey backdrop.

Head over to the Channels palette and review each of the Red, Green and Blue channels. Each one will be made up of slightly different tones, pick the one with the most contrast between foreground and background. Drag this channel onto the new channel icon to duplicate it.

With only the new channel selected, adjust the Levels (CMD+L) to dramatically increase the contrast between light and dark areas. However, don’t go too far, as you’ll notice some horrendous pixilation appearing in the fine areas.

Due to the slight variation in tone of the background, it appears grey in the darker areas. Use the Dodge tool set to a low Opacity to target the highlights and brush over this background area to really brighten it up.

Switch over to the Burn tool and target the shadows to dramatically darken down the inner areas of the image to pure black.

Use the brush tool to finish off the blacks by painting over the remaining areas of the inner section of the image.

Inverse the image to switch over the black and white areas (CMD+I), and give a quick check for any stray areas that may have been missed by the brush.

CMD+Click the Channel thumbnail to load the selection, then turn back on the visibility of the original channels. Head back over to the Layers palette and copy the selection. Paste it on a new layer and hide the original to see the cut out image against transparency.

The selection has managed to trim out even the finest of hairs to give a realistic cut. Paste the photo against an alternate background. Zoom in and check for any light coloured fringes around the edges, especially if placed against a darker background. These can be reduced using the Burn tool set to Highlights and gently brushed over the outline of the image.

Technique Two: Images with Detailed Backgrounds

The Channels technique is all well and good for studio photography with plain backgrounds, but it gets a little more difficult on standard shots with detailed backgrounds getting in the way.

Open up your image in Photoshop. This image has a decent contrast between foreground and background, but certain areas of the hair do blend in with the darker tones of the backdrop.

Start by trimming out the clear edges with the Pen Tool, but when you reach the hair simply create a rough tracing.

Around the hair portion, aim to include only solid areas of hair that aren’t merging with the background, otherwise the lighter tones will mess things up later.

Make a selection with a feathering of 0.2 pixels to remove any harsh edges then paste onto a new layer. Reduce the transparency of the image so that the original hair line can just be seen.

Here’s where the fun begins! Use the Smudge Tool to draw in areas of new hair, using the original outline as a template. Begin with a 4px brush to flesh out the thick base hair and disguise the jaggy lines from the path. A Wacom Graphics Tablet really comes in handy here to speed up the process and help add varied line thicknesses.

The new hair will soon flesh out the image back to its original appearance. It doesn’t look too bad at this stage, but repeating the process with a thinner brush will draw in those individual hairs.

Use a 2px brush with the Smudge Tool to draw thin stray hairs in varied directions to add realism to the image.

The photo can then be placed on any background with ease, and displays a crisp cut-out with no fringing or loss of fine detail.

Saturday, May 7, 2011

Video tutorial on Photoshop



A tutorial is one method of transferring knowledge and may be used as a part of a learning process. More interactive and specific than a book or a lecture; a tutorial seeks to teach by example and supply the information to complete a certain task.
Depending on the context a tutorial can take one of many forms, ranging from a set of instructions to complete a task to an interactive problem solving session (usually in academia).


Sunday, May 1, 2011

Photo Gallery in Jquiry


View demo Download source
Today we will create a stunning full page photo wall gallery. The idea is to have a whole page full of thumbs with a nice light effect when we hover. When an image is clicked, a panel slides up from the bottom revealing the full picture. When clicking on the full image, the thumbs panel slide back from the bottom. This effect will give the impression that we are stacking the panels on top of each other every time we change the mode. In the full picture view we add some nice transition effect when we browse through the photos.
In addition, we will use a function for resizing the full image, adapting it to the size of the screen. So, when the screen get’s resized, our image will adapt automatically!
The beautiful images in the demo are from Vincent Boiteau’s photostream on Flickr.
This tutorial will be a little bit more complex than usual, so I will give my best to explain things clearly.
Let’s get started with the markup.

The Markup

The HTML structure consists of three main containers: one for the info bar at the bottom of the page, one for the thumbnails and one panel container for the full image:
<div class="infobar">
	<span id="description"></span>
	<span id="loading">Loading Image</span>
</div>
<div id="thumbsWrapper">
	<div id="content" >
		<img src="thumbs/1.JPG" alt="images/1.JPG" title="something"/>
		<img src="thumbs/2.JPG" alt="images/2.JPG" title="something"/>
		...
		<div class="placeholder"></div>
	</div>
</div>
<div id="panel">
	<div id="wrapper">
		<a id="prev"></a>
		<a id="next"></a>
	</div>
</div>
The info bar container has a span for the image description and one for the loading display. The thumbnail wrapper contains a content container for all the small images. The very last element after the thumbnails is a placeholder. We need to add some space to the end because we don’t want the thumbnails to get covered by the info bar. Since we don’t want to use any paddings or margins in our containers, we simply add another filler element.
The structure for the panel contains a wrapper for the full image and two navigation items. In our JavaScript function we will add the full size image to this wrapper.
Now, let’s take a look at the style.

The CSS

First, we will define some general style for the page:
*{
    margin:0;
    padding:0;
}
body{
    background-color:#000;
    font-family:Verdana;
    text-transform:uppercase;
    color:#fff;
    font-size:10px;
    overflow:hidden;
}
The body needs to get the property overflow hidden, because we will set the scroll bar for the thumbs view only. If we would add scrolling to the page, the scroll bar would appear when the full image panel slides up. We avoid that by saying that the overflow will be hidden for the body.
The info bar will have a fixed position. We always want it to be visible and at the same place in the page:
.infobar{
    background-color:#000;
    height:28px;
    line-height:28px;
    right:20px;
    position:fixed;
    bottom:0px;
    left:20px;
    z-index:999999999;
    text-align:center;
    color:#ddd;
    -moz-border-radius:10px 10px 0px 0px;
    -webkit-border-top-left-radius:10px;
    -webkit-border-top-right-radius:10px;
    border-top-left-radius:10px;
    border-top-right-radius:10px;
    text-shadow:0px 0px 1px #ccc;
}
We add some border radius for rounded borders. We set the z-index crazily high since we want the element to be always on top. of course you could just use a value like 15 or 50. Just be careful with the other elements that will get a new z-index dynamically in the JS. The highest one of them is 10.
The description and the loading item will have the following style:
span#description{
    text-shadow:1px 1px 1px #000;
    display:none;
}
span#loading{
    display:none;
    padding-right: 30px;
    background:transparent url(../loading.gif) no-repeat center right;
}
The loading item will have a loading image as background.
The thumbs wrapper will have a panel like style. We set it fixed, occupying the whole screen. Important for the effect is the bottom:0px since we will want the wrapper to come up from the bottom by animating its height. Again, we set the overflow to hidden, since we just want the content container to have a scroll bar.
#thumbsWrapper{
    overflow:hidden;
    position:fixed;
    height:100%;
    width:100%;
    left:0px;
    right:0px;
    bottom:0px;
}
The content wrapper will also occupy all the page. The vertical scroll bar we set explicitly by saying overflow-y:scroll (auto would be the default value). Initially, we want this container to be invisible because we don’t want to show the scroll bar while there is nothing on the page during the initial loading time.
#content{
   position:absolute;
   top:0px;
   height:100%;
   width:100%;
   left:0px;
   background-color:#111;
   overflow-y:scroll;
   display:none;
}
The images in the content container will float left and have an opacity of 0.4. The hover function will then increase opacity, giving the whole thing a spotlight effect.
#content img{
    float:left;
    margin:2px;
    cursor:pointer;
    opacity:0.4;
    filter:progid:DXImageTransform.Microsoft.Alpha(opacity=40);
}
The placeholder will make sure that our thumbs don’t get covered by the info bar when we are at the bottom of the page:
.placeholder{
    float:left;
    clear:both;
    width:100%;
    height:30px;
}
The panel will have the following style similar to the style of the thumbs wrapper:
#panel{
    background-color:#222;
    width:100%;
    position:fixed;
    bottom:0px;
    left:0px;
    right:0px;
    height:0px;
    text-align:center;
}
Initially, the
#panel img{
    cursor:pointer;
    position:relative;
    border:1px solid #000;
    -moz-box-shadow:0px 0px 10px #111;
    -webkit-box-shadow:0px 0px 10px #111;
    box-shadow:0px 0px 10px #111;
    display:none;
}
We set it to display:none since we will make it appear by fading it in. This will create a nice effect.
The image wrapper be centered horizontally. This we achieve by setting the left and right margins to auto.
#wrapper{
    position:relative;
    margin:40px auto 0px auto;
}
The navigation items will have the following style:
a#next,
a#prev{
    width:40px;
    height:40px;
    position:fixed;
    cursor:pointer;
    outline:none;
    display:none;
    background:#aaa url(../nav.png) no-repeat top left;
}
a#next:hover, a#prev:hover{
    background-color:#fff;
}
a#next{
    right:0px;
    top:50%;
    margin-top:-20px;
    background-position: 0px 0px;
}
a#prev{
    left:0px;
    top:50%;
    margin-top:-20px;
    background-position: 0px -40px;
}
We give the navigation items a fixed position. To center an absolute or fixed element horizontally (or vertically) you can give it a top (or left) value of 50% and then a negative top (or left) margin of half of its height (or width). Since the navigation item is 40px high, our top margin is is -20px.
And that was all the style. Now, let’s take a look at the JavaScript magic:

The JavaScript

OK, don’t scare, it’s a bit lengthy… but don’t worry, most of it is comments and code indention :)
Our main functions fire when we click on a thumb or click on a full image.
When clicking on a thumbnail (line 34) we first show our loading item in the info bar. Then we say to load the respective image (line 40) with the source being the alt attribute of the thumb we clicked (line 92). Everything that is inside of the load function will just be executed after the image is loaded (line 41 to 93). So, we hide the loading item from the info bar, resize the image to fit into the viewport and append the image element to the wrapper. Then we fade it in (line 54) and slide up the panel where we will see the full image and the fading in effect still executing (57 – 91). We also show the description and the navigation items, and finally we make the thumbs wrapper disappear by setting the height to 0 (line 90). We do that because we want it sliding back from the bottom when we click on the full image.
For the click event on the full image (line 101 to 119) we need to use “live” since the img element is not there in the beginning but it is created dynamically. We animate the thumbs wrapper and set the panel to zero height.
The functions for browsing through the full images check which thumb image is the previous or next one and according to that we set the next or previous full image (line 128 to 137). For that we use the navigate function (line 143 to 191).
From line 18 to 26 we say that we want the full size picture to be resized whenever we resize the window. The resize function is defined from line 197 until 237. We also resize the wrapper around the image.
$(function() {
	/* this is the index of the last clicked picture */
	var current = -1;
	/* number of pictures */
	var totalpictures = $('#content img').size();
	/* speed to animate the panel and the thumbs wrapper */
	var speed 	= 500;

	/* show the content */
	$('#content').show();

	/*
	when the user resizes the browser window,
	the size of the picture being viewed is recalculated;
	 */
	$(window).bind('resize', function() {
		var $picture = $('#wrapper').find('img');
		resize($picture);
	});

	/*
	when hovering a thumb, animate it's opacity
	for a cool effect;
	when clicking on it, we load the corresponding large image;
	the source of the large image is stored as
	the "alt" attribute of the thumb image
	 */
	$('#content > img').hover(function () {
		var $this   = $(this);
		$this.stop().animate({'opacity':'1.0'},200);
	},function () {
		var $this   = $(this);
		$this.stop().animate({'opacity':'0.4'},200);
	}).bind('click',function(){
		var $this   = $(this);

		/* shows the loading icon */
		$('#loading').show();

		$('').load(function(){
			$('#loading').hide();
			if($('#wrapper').find('img').length) return;
			current 	= $this.index();
			var $theImage   = $(this);
			/*
			After it's loaded we hide the loading icon
			and resize the image, given the window size;
			then we append the image to the wrapper
			*/
			resize($theImage);

			$('#wrapper').append($theImage);
			/* make its opacity animate */
			$theImage.fadeIn(800);

			/* and finally slide up the panel */
			$('#panel').animate({'height':'100%'},speed,function(){
				/*
				if the picture has a description,
				it's stored in the title attribute of the thumb;
				show it if it's not empty
				 */
				var title = $this.attr('title');
				if(title != '')
					$('#description').html(title).show();
				else
					$('#description').empty().hide();

				/*
				if our picture is the first one,
				don't show the "previous button"
				for the slideshow navigation;
				if our picture is the last one,
				don't show the "next button"
				for the slideshow navigation
				 */
				if(current==0)
					$('#prev').hide();
				else
					$('#prev').fadeIn();
				if(current==parseInt(totalpictures-1))
					$('#next').hide();
				else
					$('#next').fadeIn();
				/*
				we set the z-index and height of the thumbs wrapper
				to 0, because we want to slide it up afterwards,
				when the user clicks the large image
				 */
				$('#thumbsWrapper').css({'z-index':'0','height':'0px'});
			});
		}).attr('src', $this.attr('alt'));
	});

	/*
	when hovering a large image,
	we want to slide up the thumbs wrapper again,
	and reset the panel (like it was initially);
	this includes removing the large image element
	 */
	$('#wrapper > img').live('click',function(){
		$this = $(this);
		$('#description').empty().hide();

		$('#thumbsWrapper').css('z-index','10')
		.stop()
		.animate({'height':'100%'},speed,function(){
			var $theWrapper = $(this);
			$('#panel').css('height','0px');
			$theWrapper.css('z-index','0');
			/*
			remove the large image element
			and the navigation buttons
			 */
			$this.remove();
			$('#prev').hide();
			$('#next').hide();
		});
	});

	/*
	when we are viewing a large image,
	if we navigate to the right/left we need to know
	which image is the corresponding neighbour.
	we know the index of the current picture (current),
	so we can easily get to the neighbour:
	 */
	$('#next').bind('click',function(){
		var $this           = $(this);
		var $nextimage 		= $('#content img:nth-child('+parseInt(current+2)+')');
		navigate($nextimage,'right');
	});
	$('#prev').bind('click',function(){
		var $this           = $(this);
		var $previmage 		= $('#content img:nth-child('+parseInt(current)+')');
		navigate($previmage,'left');
	});

	/*
	given the next or previous image to show,
	and the direction, it loads a new image in the panel.
	 */
	function navigate($nextimage,dir){
		/*
		if we are at the end/beginning
		then there's no next/previous
		 */
		if(dir=='left' && current==0)
			return;
		if(dir=='right' && current==parseInt(totalpictures-1))
			return;
		$('#loading').show();
		$('').load(function(){
			var $theImage = $(this);
			$('#loading').hide();
			$('#description').empty().fadeOut();

			$('#wrapper img').stop().fadeOut(500,function(){
				var $this = $(this);

				$this.remove();
				resize($theImage);

				$('#wrapper').append($theImage.show());
				$theImage.stop().fadeIn(800);

				var title = $nextimage.attr('title');
				if(title != ''){
					$('#description').html(title).show();
				}
				else
					$('#description').empty().hide();

				if(current==0)
					$('#prev').hide();
				else
					$('#prev').show();
				if(current==parseInt(totalpictures-1))
					$('#next').hide();
				else
					$('#next').show();
			});
			/*
			increase or decrease the current variable
			 */
			if(dir=='right')
				++current;
			else if(dir=='left')
				--current;
		}).attr('src', $nextimage.attr('alt'));
	}

	/*
	resizes an image given the window size,
	considering the margin values
	 */
	function resize($image){
		var windowH      = $(window).height()-100;
		var windowW      = $(window).width()-80;
		var theImage     = new Image();
		theImage.src     = $image.attr("src");
		var imgwidth     = theImage.width;
		var imgheight    = theImage.height;

		if((imgwidth > windowW)||(imgheight > windowH)){
			if(imgwidth > imgheight){
				var newwidth = windowW;
				var ratio = imgwidth / windowW;
				var newheight = imgheight / ratio;
				theImage.height = newheight;
				theImage.width= newwidth;
				if(newheight>windowH){
					var newnewheight = windowH;
					var newratio = newheight/windowH;
					var newnewwidth =newwidth/newratio;
					theImage.width = newnewwidth;
					theImage.height= newnewheight;
				}
			}
			else{
				var newheight = windowH;
				var ratio = imgheight / windowH;
				var newwidth = imgwidth / ratio;
				theImage.height = newheight;
				theImage.width= newwidth;
				if(newwidth>windowW){
					var newnewwidth = windowW;
					var newratio = newwidth/windowW;
					var newnewheight =newheight/newratio;
					theImage.height = newnewheight;
					theImage.width= newnewwidth;
				}
			}
		}
		$image.css({'width':theImage.width+'px','height':theImage.height+'px'});
	}
});
For further details, check the comments in the code, they describe what is done in the moment.
And that’s it! I hope you enjoyed the tutorial and the result!