Navigation


How To Do Facial Photo-manipulation (Photoshop)

April 27th, 2007, Photoshop, General, admin, 0 Comments Print This Post Print This Post

A : In this tutorial I will Explain you how to manipulate a facial image and make it compatible for web. I will show you how to soften the skin, change the eye colour and brighten the teeth, and some other things. Here’s the picture we will be using:

First of all, we will remove the background. To do this we can use the lasso tool. Select the area around the person you are manipulating, but don’t try to be precise, we will sort that out later.

When you are done with selecting, switch to quick mask mode in order to make the selection more precise. Now what you need to do is “colour” the area that is not necessary by black colour and a brush of wanted size. This is the time when you should be as precise as you can. This is what you should get in the end:

While still in quick mask mode apply a Gaussian blur with radius of 1 pixel, in order to soften the edges we are about to cut. After you have done that switch to standard mode, invert the selection and delete the background.

Note: It’s best to do this on a new layer, so you don’t touch the original image.

Anyway, if you turn of the original layer, you should get something like this:

Now let’s move one to the skin. To soften the skin we are going to use a quite primitive method. First of all, apply a Gaussian blur of a certain radius so that the skin appears to be softer, but not unreal. In this case, I have used the radius 7. Now, you must open the history window, and select the small square next to the Gaussian blur. Then make a step backwards. What we are doing is applying the blur only to some parts, in this case the skin. Now, activate the history brush of the wanted size and carefully go over the skin. This way you will get the Gaussian blur only applied to the skin.

The result in my case is this:

And now - the teeth. This one can be done in an easy way, but you can complicate it a lot when you master face photo manipulation. I’ll do it the easy way. First switch to quick mask mode and select the teeth (be precise). After that copy the teeth to a new layer. There you can mess with the brightness and other options, that usually works. If it looks unreal in the end, feel free to change the opacity of that layer.

Here’s Ivana with new teeth:

Now we move on to the eyes. I will lighten the eyes a bit and change their colour to green. For brightening them, do the following. Create a new layer, and then go to Edit > Fill, and choose 50% gray. Change that layer’s mode to Soft Light and activate the dodge tool. Now use the dodge tool on the white part of the eyes to lighten it a bit. I suggest you experiment with this, since it is quite hard to do it right. The difference might not be noticeable, but it’s there.

This picture is not very high quality, so changing the eye colour wouldn’t be successful. If you want to change the eye colour, this is what you have to do. First select the eyes and copy them onto a new layer. Then desaturate that layer, and edit the curves for it. That way you will be able to set the wanted colour and it will look natural. In addition to that, you can adjust the opacity for that layer in order to make it more realistic.

What we can do now is beautify the eyebrows. You can do this in two ways. You can use the Smudge tool, or use the Clone Stamp tool. It is really up to you. If you are using the Smudge tool, make slow and gentle moves in order to hide that action. If you are using the Clone Stamp tool, select an area as close to the eyebrow as it is possible. I have used the Smudge tool and here is what I got.

And now, the final touch. Choose a random background that you find appropriate and put it in a new layer below the person layer. After that you may apply any effects you want. I have chosen a forest background and blurred it a little bit.

And here it is - what it looked like in the beginning and what it looks like now.

Webhosting - 0.99$/Pay monthly 1 GB Space, 5GB BW, Cpanel etc

del.icio.us Digg it Earthlink Furl iFeedReaders ma.gnolia Maple.nu Netvouz Netscape RawSugar reddit Scuttle Shadows Simpy Spurl StumbleUpon Wink Yahoo MyWeb

PHP Tutorial: Form Verification And Simple Validation, A One Page script for PHP form verification.

April 27th, 2007, Php, General, admin, 0 Comments Print This Post Print This Post

Having used various means of verifying HTML forms I believe that this method of verifying a form to be the best mostly because it does everything on one page. It presents the form on one page and then when the submit button is pressed, if all the required fields are not filled out then it will present the form again with all the fields intact and in red lettering will point out the fields that are required to be filled out in red. It is not possible to click submit using this method even if the user has turned JavaScript off. While it is possible to use javascript to verify that all fields are filled out, if the user has turned off Javascript this method will not work any way. This is done using PHP and if you are hosted with Astahost then why not go ahead and use it. The only thing this form will not do is repopulate checkboxes since they are usually an indexed array (but don’t have to be , they could be associative) and I have another method for that but that is for later. You can take this script and modify it after seeing how it works and make it perform the way you would like for it to. This method will use both HTML and PHP in the same page so lets get started

CODE

<form action=”form.php” method=”post”>

<table border=”1″ cellpadding=”2″ bgcolor=”azure”><!–Put a nice border areound the table and add soft color–>

<tr>

<td width=”20%” align=”right”>First Name</td>

<td width=”80%”>

<input type=”text” name=”firstname” size=”20″ value=”<?php echo $_POST[firstname] ?>”></td><!–NOTICE the php in the values–>

</tr>

<tr>

<td width=”20%” align=”right”>Last Name</td>

<td width=”80%”>

<input type=”text” name=”lastname” size=”20″ value=”<?php echo $_POST[lastname] ?>”></td><!–will echo users input for repopulation–>

</tr>

<tr>

<td width=”20%” align=”right”>Username</td>

<td width=”80%”>

<input type=”text” name=”username” size=”20″ value=”<?php echo $_POST[username] ?>”> (must be between

6 an 12 characters)</td>

</tr>

<tr>

<td width=”20%” align=”right”>Password</td>

<td width=”80%”>

<input type=”password” name=”password” size=”20″ value=”<?php echo $_POST[password] ?>”>

(Password must be at least 6 characters)</td>

</tr>

<tr>

<td width=”20%” align=”right”>E-mail</td>

<td width=”80%”>

<input type=”text” name=”email” size=”40″ value=”<?php echo $_POST[email]; ?>”></td><!–Give more room for long emails–>

</tr>

<tr>

<td width=”20%” align=”right”> </td>

<td width=”80%”>

<input type=”submit” value=”” name=”submit”></td>

</tr>

</table>

<h3>The Username Password and the E-mail fields are required!</h3>

</form>

Using the code above as a model you can modify it to suit your needs for your own site. The regex used to validate I found at the Zend site and is meant to work with .be or .any two or three character extension in a URL I have just finished working on a script that repopulates checkbox data. After looking all over the net for a tutorial or even asking in forums to make it work, I built my own that works like I want, so if there are enough requests I will post it along with explainations and comments. It takes four pages of code to work, but two of them are almost identical it is just that one inserts data and the other updates the database.

CODE :

<?php /* this is guarunteed to work it is possible to use <? (short tags but this style works everywhere).*/

/*Only verify/validate form when it is submitted program name: form.php */

if(isset($_POST[submit])){

$error=”;//initialize $error to blank

if(trim($_POST[username])==” || strlen(trim($_POST[username])) < 6 ||strlen(trim($_POST[username])) >12){

$error.=”Please enter a username between 6 and 12 characters!<br />”; //concatenate the $error Message with a line break

}

if(trim($_POST[password])==” || strlen(trim($_POST[password]))< 6){

$error.=”Your password must be at least 6 characters in length!<br />”;//concatenate more to $error

}

if(trim($_POST[email])==”){

$error.=”An email address is required!<br />”;

}

else {

if(!eregi(”^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$”, $_POST[email])) {

$error=”The e-mail you entered was not in the proper format!”;

}
}
if($error==”){//Hmmmm no text is in $error so do something else, the page has verified and the email was valid
// so uncomment the line below to send the user to your own success page or wherever (swap yourpage.php with your files location).
//echo “script type=\”text/javascript\”>window.location=\yourpage.php\”<script>”;
}
else{
echo “<span style=color:red>$error</span>”;
}
}
?>

That ends the PHP part of the script except for some PHP echos in the HTML section. The first line of code checks to see if the submit button has been pressed, it won’t do anything unless submit has been pressed so then the code goes right to the HTML part below thiese explainations. The next two if conditional statements check that if the user name and password meet the conditions following the if. In the case of the username if it is equal to ” (blank) OR if the length of the string after PHP has trimmed trailing whitespace is < (less than) 6 OR if the length of username is > (greater than) 12 then it will add to the $error variable and display the message in red because of the style embedded in the script. The || means OR in PHP and in the second if condition it works the same as the username only it requires at least 6 letters or letters and numbers or any printable character.

The verification and validation requires a little more explaination becuase it uses a regular expression to test for a valid email address. The first part of the email just checks to be sure that they even enter something and if they did then the else statement checks to see that the email is in a valid format namely a group or alphanumeric or printable charactersthen a “@” symbol then more alphanumeric characters and a “.”followed by alphabetic characters. the “,” seperating the regex then gives the second part with is theemail to check against. If this test fails then the user will see the form redisplayed with the message “The email you entered was not in the proper format!” will show in red.

If there are no errors the last if condition checks if the $error variable is empty or blank and if so then you would remove the comment the(//) in front of the echo “<…. and change the URL to the page you want the user to use. Finally all the concatenated
$errors are printed by the else statement. So now all that is left is to write the HTML form. and it is below and is tacked just below the code above these explainations. NOTE Just copy and paste the first section of code and then copy and paste the HTML below right after the the ?> closing tag.

CODE

<form action=”form.php” method=”post”>

<table border=”1″ cellpadding=”2″ bgcolor=”azure”><!–Put a nice border areound the table and add soft color–>

<tr>

<td width=”20%” align=”right”>First Name</td>

<td width=”80%”>

<input type=”text” name=”firstname” size=”20″ value=”<?php echo $_POST[firstname] ?>”></td><!–NOTICE the php in the values–>

</tr>

<tr>

<td width=”20%” align=”right”>Last Name</td>

<td width=”80%”>

<input type=”text” name=”lastname” size=”20″ value=”<?php echo $_POST[lastname] ?>”></td><!–will echo users input for repopulation–>

</tr>

<tr>

<td width=”20%” align=”right”>Username</td>

<td width=”80%”>

<input type=”text” name=”username” size=”20″ value=”<?php echo $_POST[username] ?>”> (must be between

6 an 12 characters)</td>

</tr>

<tr>

<td width=”20%” align=”right”>Password</td>

<td width=”80%”>

<input type=”password” name=”password” size=”20″ value=”<?php echo $_POST[password] ?>”>

(Password must be at least 6 characters)</td>

</tr>

<tr>

<td width=”20%” align=”right”>E-mail</td>

<td width=”80%”>

<input type=”text” name=”email” size=”40″ value=”<?php echo $_POST[email]; ?>”></td><!–Give more room for long emails–>

</tr>

<tr>

<td width=”20%” align=”right”> </td>

<td width=”80%”>

<input type=”submit” value=”” name=”submit”></td>

</tr>

</table>

<h3>The Username Password and the E-mail fields are required!</h3>

</form>

Using the code above as a model you can modify it to suit your needs for your own site. The regex used to validate I found at the Zend site and is meant to work with .be or .any two or three character extension in a URL I have just finished working on a script that repopulates checkbox data. After looking all over the net for a tutorial or even asking in forums to make it work, I built my own that works like I want, so if there are enough requests I will post it along with explainations and comments. It takes four pages of code to work, but two of them are almost identical it is just that one inserts data and the other updates the database.

Webhosting - 0.99$/Pay monthly 1 GB Space, 5GB BW, Cpanel etc

del.icio.us Digg it Earthlink Furl iFeedReaders ma.gnolia Maple.nu Netvouz Netscape RawSugar reddit Scuttle Shadows Simpy Spurl StumbleUpon Wink Yahoo MyWeb « Previous Entries


Last 25 post


Subcribe

    Add to Google Reader or Homepage

    Subscribe in NewsGator Online

    Add to My AOL

    Add Ask N Answer to Newsburst from CNET News.com

    Subscribe in Bloglines

    Subscribe in FeedLounge

Pages


Category


Archive


Links