You may have lot of experiences with image filters using in image processing soft wares.By using php also you can add filters to a image create following php file and get experienced with.
Interface image and codes are bellow.For example, I have taken here created a folder named "mod" in root directory and used a kid.png image for adding filter effects.Brite
Value1 | ||
Value2 | ||
Value3 | ||
Operation:- | Brightness | GRAY SCALE |
CONTRAST | COLORIZE | |
Edge Effects | EMBOSS | |
GAUSSIAN BLUR | MEAN REMOVAL | |
SMOOTH | NEGATE | |
gray scale to colorize | SELECTIVE BLUR | |
Codes are bellow.
<html> <title> </title> <body> <table bgcolor=#d38a2a> <form name="calc" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <tr bgcolor=#ffffff><td align="center" colspan=3><img src="kid.png"></td></tr> <tr bgcolor=#ffffff><td colspan=2>Value1</td><td><input type="text" name="value1"></td></tr> <tr bgcolor=#ffffff><td colspan=2>Value2</td><td><input type="text" name="value2"></td></tr> <tr bgcolor=#ffffff><td colspan=2>Value3</td><td><input type="text" name="value3"></td></tr> <tr bgcolor=#ffffff><td>Operation:-</td><td><input type="radio" name="oper" value="brv">Briteness</td><td><input type="radio" name="oper" value="gry">GRAYSCALE</td></tr> <tr bgcolor=#ffffff><td> </td><td><input type="radio" name="oper" value="cont">CONTRAST</td><td><input type="radio" name="oper" value="col">COLORIZE</td></tr> <tr bgcolor=#ffffff><td> </td><td><input type="radio" name="oper" value="ege">Edge Effects</td><td><input type="radio" name="oper" value="emb">EMBOSS</td></tr> <tr bgcolor=#ffffff><td> </td><td><input type="radio" name="oper" value="gau">GAUSSIAN BLUR</td><td><input type="radio" name="oper" value="mrm">MEAN REMOVAL</td></tr> <tr bgcolor=#ffffff><td> </td><td><input type="radio" name="oper" value="smth">SMOOTH</td><td><input type="radio" name="oper" value="neg">NEGATE</td></tr> <tr bgcolor=#ffffff><td> </td><td><input type="radio" name="oper" value="grco">grayscale to colorize</td><td><input type="radio" name="oper" value="sblur">SELECTIVE BLUR</input></td></tr> <tr bgcolor=#ffffff><td colspan=3 align="right"><input type="submit" value="Add Filter"></td></tr> </form> </table> </table> </form> <?php $val=$_POST['value1']; $val2=$_POST['value2']; $val3=$_POST['value3']; $oper=$_POST['oper']; if($oper=='brv'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_BRIGHTNESS,$val); imagepng($image, 'mod/img_filter_brightness_5.png'); imagedestroy($image); echo "Briteness Added Image</br><img src='mod/img_filter_brightness_5.png'>"; } else if($oper=='gry'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_GRAYSCALE); imagepng($image, 'mod/img_filter_grayscale.png'); imagedestroy($image); echo "Gray Scaled Image</br><img src='mod/img_filter_grayscale.png'>"; } else if($oper=='cont'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_CONTRAST, $val); imagepng($image, 'mod/img_filter_contrast_5.png'); imagedestroy($image); echo "Contrast Added Image</br><img src='mod/img_filter_contrast_5.png'>"; } else if($oper=='col'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_COLORIZE, $val, $val2, $val3); imagepng($image, 'mod/img_filter_colorize_100_0_0.png'); imagedestroy($image); echo "Colorized Image</br><img src='mod/img_filter_colorize_100_0_0.png'>"; } else if($oper=='emb'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_EMBOSS); imagepng($image, 'mod/img_filter_emboss.png'); imagedestroy($image); echo "Emboss Image</br><img src='mod/img_filter_emboss.png'>"; } else if($oper=='ege'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_EDGEDETECT); imagepng($image, 'mod/img_filter_edgedetect.png'); imagedestroy($image); echo "Edge Detect Image</br><img src='mod/img_filter_edgedetect.png'>"; } else if($oper=='gau'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR); imagepng($image, 'mod/img_filter_gaussian_blur.png'); imagedestroy($image); echo "Gaussian blur Image</br><img src='mod/img_filter_gaussian_blur.png'>"; } else if($oper=='mrm'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_MEAN_REMOVAL); imagepng($image, 'mod/img_filter_mean_removal.png'); imagedestroy($image); echo "Mean Removed Image</br><img src='mod/img_filter_mean_removal.png'>"; } else if($oper=='smth'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_SMOOTH, $val); imagepng($image, 'mod/img_filter_smooth_5.png'); imagedestroy($image); echo "Smooth Image</br><img src='mod/img_filter_smooth_5.png'>"; } else if($oper=='neg'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_NEGATE); imagepng($image, 'mod/img_filter_negate.png'); imagedestroy($image); echo "Negate Image</br><img src='mod/img_filter_negate.png'>"; } else if($oper=='grco'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_GRAYSCALE); imagefilter($image, IMG_FILTER_COLORIZE,$val,$val2,$val3); imagepng($image, 'mod/sepia_100_50_0.png'); imagedestroy($image); echo "colorize Image</br><img src='mod/sepia_100_50_0.png'>"; } else if($oper=='sblur'){ $image = imagecreatefrompng('kid.png'); imagefilter($image, IMG_FILTER_SELECTIVE_BLUR); imagepng($image, 'mod/img_filter_selective_blur.png'); imagedestroy($image); echo "Selective Blur Image</br><img src='mod/img_filter_selective_blur.png'>"; } else { echo "<font color='red'>Fialed!</font>"; } ?> </body> </html> |
No comments:
Post a Comment