That's right, PHP can also achieve the sharpening, blur, relief, etc. of the picture. Because PHP is not here as the web page foot, but in the case of efficiency, let us see what to do with CGI.
The following is already included in the FAQ of PHP in 9CBS: http://community.9cbs.net/expert/faq/faq_index.asp? Id = 188506 / * ============ ============================================================================================================================================================================================================= ======== Design by: Peng Guohui Site: http://kacarton.yeah.net/ blog: http://blog.9cbs.net/nhconch email: kacarton@sohu.com Article is the author original, reprinted Please contact me before, please indicate the article, retain the author information, thank you for your support! ============================================================================================================================================================================================================= ========================// read image type // 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);} // Image Sharp // $ SCR_IM: Image Resource Handle, $ Degree: Sharpening Function Sharp (& $ SRC_IM, & $ DST_IM, $ DEGREE) {$ src_x = imagesx ($ src_im); $ src_y = imagesy; // $ 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_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 = intV ($ 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 "; IF ($ DST_CLR = ImageColorexact ($ DST_IM, $ R, $ G, $ B)) == - 1) $ dst_clr = ImageColor Allocate ($ 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");! if (empty ($ _ POST [ "ImageName "])) {Set_time_limit (10 * 60);
IF ($ iMAGETYPE = GetImageType ($ _ post ["iMageName"]) == false) DIE ("Specify file does not exist or not a valid picture or does not support type!"); if ($ iMageType == 6) $ IMageType = 0; IF ($ iMAGETYPE> 3) Die ("Not supported picture type!"); $ IM1 = $ imagefunctions [$ imagetype] ($ _ post ["imagename"); $ IM2 = $ imagefunctions [$ iMAGETYPE ] ($ _ Pos "); // Print_R (ImageColorsfor Index ($ IM, ImageColoRAT)); Sharp ($ IM1, $ IM2, $ _POST [" degree "]); Header ("Content-Type: Image / PNG"); ImagePNG ($ IM2); ImageDestroy ($ IM1); ImageDestroy ($ IM2);}?>