php图像函数 imagecreatetruecolor()和imagecreate()的区别
来源:互联网 发布:洗面奶 知乎 编辑:程序博客网 时间:2024/05/20 23:06
用imagecreatetruecolor(int x,int y)建立的是一幅大小为 x和 y的黑色图像(默认为黑色),如想改变背景颜色则需要用填充颜色函数imagefill($img,0,0,$color);
imagecreate 新建一个空白图像资源,用imagecolorAllocate()添加背景色
上面两个函数只不过是一个功能的两种方法
具体用法见以下两种方法:
<?php
$img = imagecreatetruecolor(100,100); //创建真彩图像资源
$color = imagecolorAllocate($img,200,200,200); //分配一个灰色
imagefill($img,0,0,$color); // 从左上角开始填充灰色
header('content-type:image/jpeg'); //jpg格式
imagejpeg($img); //显示灰色的方块
?>
<?php
$img = imagecreate(100,100);
$color = imagecolorallocate($img,200,200,200);
header('content-type:image/jpeg'); //jpg格式
imagejpeg($img); //显示灰色的方块
?>
转载自:
http://blog.sina.com.cn/s/blog_68b56adb0100vnhn.html
0 0
- php图像函数 imagecreatetruecolor()和imagecreate()的区别
- php图像函数 imagecreatetruecolor()和imagecreate()的区别
- php图像函数 imagecreatetruecolor()和imagecreate()的区别
- imagecreatetruecolor()和imagecreate()的区别
- imagecreatetruecolor()与imagecreate()生成图像时的背景色
- 3. PHP 创建图像、销毁图像 imagecreate 与 imagedestroy 函数
- Call to undefined function imagecreatetruecolor() imageCreate() 的gd库解决办法
- PHP图像处理之imagecreate、imagedestroy函数介绍
- [PHP] GD库(四):创建图像、销毁图像 imagecreate 与 imagedestroy 函数
- PHP error: Call to undefined function imagecreate()的解决办法
- PHP发生Call to undefined function imagecreate()错误的解决办法
- PHP发生Call to undefined function imagecreate()错误的解决办法
- PHP发生Call to undefined function imagecreate()错误的解决办法
- imagecreatetruecolor背景颜色的改变
- PHP函数isset和empty的区别
- PHP strstr() 和 strpos() 函数的区别
- PHP函数addslashes和mysql_real_escape_string的区别
- php语言结构和函数的区别
- css布局学习心得
- Java常用类之Calendar类和GregorianCalendar类
- 行级触发器与语句级触发器的区别
- 全局变量
- 【分享】推荐一些不错的计算机书籍
- php图像函数 imagecreatetruecolor()和imagecreate()的区别
- Hibernate学习(8)关系映射
- Java 环境变量设置
- I Hate It
- js跨域及解决方法
- 基于websocket的前端与后端之间的数据交互
- Unknown character set: 'utf8mb4'
- 移植u-boot-2015.07-rc3之uboot裁剪及启动参数修改(九)
- python菜鸟日记2