• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • PHP中實現圖片的銳化

    發表于:2007-09-07來源:作者:點擊數: 標簽:
    <? //讀取圖像的類型 //1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF function GetImageType($filename) {return (($i
     ?。?

      //讀取圖像的類型

      //1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF

      function GetImageType($filename) {return (($imginfo=@getimagesize($filename))!=null ? $imginfo[2] : null);}   

      //圖像銳化

      //$scr_im:圖像資源句柄,$degree:銳化度數

      function Sharp(amp;$src_im, amp;$dst_im, $degree)

      {

       $src_x = imagesx($src_im);

       $src_y = imagesy($src_im);

       //$dst_im = imagecreate($src_x, $src_y);

       //imagecopy($dst_im, $src_im, 0, 0, 0, 0, $src_x, $src_y);

       $cnt = 0;

       for ($x=1; $x<$src_x; $x++)

       for ($y=1; $y<$src_y; $y++)

       {

       $src_clr1 = imagecolorsforindex($src_im, imagecolorat($src_im, $x-1, $y-1));

       $src_clr2 = imagecolorsforindex($src_im, imagecolorat($src_im, $x, $y));

       $r = intval($src_clr2["red"]+$degree*($src_clr2["red"]-$src_clr1["red"]));

       $g = intval($src_clr2["green"]+$degree*($src_clr2["green"]-$src_clr1["green"]));

       $b = intval($src_clr2["blue"]+$degree*($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<br/>";

       if (($dst_clr=imagecolorexact($dst_im, $r, $g, $b))==-1)

       $dst_clr = Imagecolorallocate($dst_im, $r, $g, $b);

       $cnt++;

       if ($dst_clr==-1) die("color allocate faile at $x, $y ($cnt).");

       imagesetpixel($dst_im, $x, $y, $dst_clr);

       }

       return $dst_im;

      }   

      $ImageFunctions = array("imagecreatefromwbmp", "imagecreatefromgif", "imagecreatefromjpeg", "imagecreatefrompng");   

      
     
    [1] [2]下一頁

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>