php图像函数 imagecreatetruecolor()和imagecreate()的区别
2013-04-01 13:24
561 查看
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); //显示灰色的方块
?>
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); //显示灰色的方块
?>
相关文章推荐
- php图像函数 imagecreatetruecolor()和imagecreate()的区别
- php图像函数 imagecreatetruecolor()和imagecreate()的区别
- php图像生成函数imagecreatetruecolor()和imagecreate()的区别
- imagecreate()与imagecreatetruecolor()区别
- imagecreatetruecolor()和imagecreate()的区别
- imagecreatetruecolor()与imagecreate()生成图像时的背景色
- PHP载入图像imagecreatefrom_gif_jpeg_png系列函数用法分析
- [PHP] GD库(五):载入图像 imagecreatefrom_gif_jpeg_png 系列函数
- PHP载入图像imagecreatefrom_gif_jpeg_png系列函数用法分析
- PHP 载入图像 imagecreatefrom_gif_jpeg_png 系列函数
- PHP错误:call to undefined function imagecreatetruecolor
- php imagecreatetruecolor 创建高清和透明图片代码小结
- Call to undefined function imagecreatetruecolor() imageCreate() 的gd库解决办法
- php imagecreatetruecolor输出字符符或验证码
- php imagecreatetruecolor 创建高清和透明图片代码小结
- php报错-Call to undefined function imagecreatetruecolor() in
- php imagecreatetruecolor()方法报未定义错误解决方法
- 4. PHP 载入图像 imagecreatefrom_gif_jpeg_png 系列函数
- PHP 分配、取消图像颜色 imagecolorallocate 与 imagecolordeallocate 函数
- [PHP] GD库(七):分配、取消图像颜色 imagecolorallocate 与 imagecolordeallocate 函数