zoukankan      html  css  js  c++  java
  • PHP图像处理

    1.创建画布:

      $img=imagescreatetruecolor(200,200);

      创建颜色并填充

      $red=imagecolorallocate($img,255,0,0);  //创建颜色

      $imagefill($img,0,10,$red);  //填充颜色

    2.画图形

      矩形:

        

        imagedrectangle($img,90,10,190,80,$green); 不填充的矩形
        imagefilledrectangle($img,90,10,190,80,$green); 填充的矩形

      线段:

        imageline($img,0,0,200,200,$blue);

      点:

        imagesetpixel ($img,50,50,$red);

      圆:

        imageellipse ($img,100,100,100,100,$green);

          image

          由图象创建函数(例如imagecreatetruecolor())返回的图象资源。

          cx

          中间的 X 坐标。

          cy

          中间的 Y 坐标。

          width

          椭圆的宽度。

          height

          椭圆的高度。

          color

          椭圆的颜色。颜色标识符由 imagecolorallocate() 创建。

      圆形:

        imagefilledarc($img,50,50,-160,40,$green);

        

      圆弧:

        imagefilledarc($img,50,50,100,50-160,40,$green,IMG_ARC_RIE);

          bool imagefilledarc ( resource image, int cx, int cy, int w, int h, int s, int e, int color, int style )
           imagefilledarc() 在 image 所代表的图像中以 cxcy(图像左上角为 0, 0)画一椭圆弧。如果成功则返回 TRUE,失败则返回 FALSEw 和 h 分别指定了椭圆的宽和高,s 和 e 参数以角度指定了起始和结束点。style 可以是下列值按位或(OR)后的值:

      写字符到图像:

        水平画:imagechar($img,5,100,100,"ABCDEFG",$red);

        垂直画:imagecharup($img,5,100,100,"ABCDEFGHIJK",$red);

    3.输出资源

        header("Content-type:image/gif");

        imagegif($img);

    4.释放资源

        imagedestry($img);

  • 相关阅读:
    HTML 5 视频/音频
    vue 未完待续
    asp.net中使用log4net
    图片预加载:jquery 图片预加载功能,可以实现先模糊在清晰的显示
    IIS配置PHP环境
    学习ASP.Net的过滤器
    最好用的jQuery插件,240多个,绝对的JQUERY插件库
    Windows7&IIS7.5部署Discuz全攻略
    AjaxPro使用
    ASP.NET XML读取、增加、修改和删除操作
  • 原文地址:https://www.cnblogs.com/subtract/p/3870767.html
Copyright © 2011-2022 走看看