httpcreditcard.bankcomm.com 用PHP實作圖象銳利化程式碼

WBOY
發布: 2016-07-29 08:37:00
原創
1412 人瀏覽過

  
//讀取影像的類型  
  //1 = GIF, 2 = JPG, 3 = PNG, 4 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13〠= SWC. $filename) {return (($imginfo=@getimagesize ($filename))!=null ? $imginfo[2] : null);}     
  //影像銳利化  
  //$scr_im、影像銳利化  
  //$scr_im/影像銳利度數柄數, (&$src_im, &$dst_im, $degree)  
  {  
   $src_x = imagesx($s〠);
   //$dst_im = imagecreate( $src_x, $src_y);  
   //imagecopy($dst_im, $src_im, 0, 0, 0, 0, 🎜>   for ($x =1; $x   for ($y=1; $y   $src_clr2 = imagecolorsforindex($src_im, imagecolorat($src_im, $x, $yrc_im, imagecolorat($src_im, $0,$$y)); red "]+$degree*($src_clr2["red"]-$src_clr1["red"]));  
   $g = intval($src_clr2["green"]+$degree*($src_clr2["green"]+$degree*($sgreen_clr2["green"]+$degree*($sgreen_clr2["green"]+$degree*($sgreen_clr2 "]-$src_clr1["green"]));  
   $b = intval($src_clr2["blue"]+$degree*($src_clr2["blue"]-$src_clr1"blue*($src_clr2["blue"]-$src_clr1"blue" ;  
   $r = min(255, max($r, 0));  
   $g = min(255, max($g, 0));  
   $b = min(255, max ($b, 0));  
   //echo "r:$r, g:$g, b:$b
";  
   if. r, $g, $b))==-1)  
   $dst_clr = Imagecolorallocate($dst_im, $r, $g, $ st_clr== -1) die("color allocate faile at $x, $y ($cnt).");  
   imagesetpixel($    return $ dst_im;  
  }     
  $ImageFunctions = array("imagecreatefromwbmp》 🎜>  if (!empty($_POST["ImageName"]))  
  {   
   set_time_limit(10*60);  
   if (($ImageType=G.==ImageType($_POST["Image)或不是有效的圖片或不支援類型! ");  
   if ($ImageType==6) $ImageType = 0;  
   if ($ImageType>3) die("不支援的圖片類型!");  
$im1 = $ImageFunctions[$ImageType]($_POST["ImageName"]);  
$im2 = $ImageFunctions[ImageType]$im2 = $ImageFunctions[$Image)( 🎜> //print_r(imagecolorsforindex($im, imagecolorat($im, 10, 10)));
鋒利($im1, $im2, $_POST["程度"]);
正文header("內容類型" : image/png");  
🎜imagepng($im2);  
🎜imagedestroy($im1);  
🎜>🎜 🎜>🎜>

  
請輸入圖片的本地路徑或URL:
  
"  size=32>
  
銳利度數(例:0.6、3.0):
  
”>
  
  
</form><🎜><🎜改位置,省了一個$im: <🎜><🎜改位置,省了一個$im: <🎜><🎜改位置,省了一個$im: <🎜><🎜改位置,省了一個$im: <🎜><🎜改位置,省了一個$im: <🎜><🎜改位置,省了一個$im: <🎜><🎜改位置,省了一個$im: <🎜><🎜 >函數 Sharp2(&$im, $ Degree)  
<<{  
<<$im cnt = 0;  
對於($x=imagesx($im)-1 ; $x--)  
對於($y=imagesy($im)-1; $y>0 ; $y--)  
 {  
 $clr1 = imagecolorsforindex,$image im, $x-1, $y-1));  
$clr2 = imagecolorsforindex($im, imagecolorat($im, $x, $y));  
$r = intval($clr2[ "red"]+$ Degree*($clr2["red"]-$clr1["red"]));  
:$g = intval($clr2["green"]+$ Degree*($clr2 ["green"]-$clr1["green"]));  
:$b = intval($clr2["blue"]+$ Degree*($clr2["blue"]-$clr1["blue "]));  
$r = min(255, max($r, 0));  
$g = min(255, max($g, 0));  
$b = min (255, max($b, 0));  

//echo "r:$r, g:$g, b:$b
";  
如果($new_clr=imagecolorexact ($im, $r, $g, $b))==-1)  
$cnt++;  
如果($new_clr==-1) die("在$x, $y ($cnt) 處顏色分配失敗。");  
影像集像素($im,$x,$y,$new_clr);
}  
}
以上就介紹了httpcreditcard.bankcomm.com用PHP實作影像銳利化程式碼,包括了httpcreditcard.bankcomm.com方面的內容,希望對PHP教學有興趣的朋友有所幫助。


相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!