超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<imagecopymergegrayimagecopyresized>
Last updated: Fri, 22 Jun 2007

imagecopyresampled

(PHP 4 >= 4.0.6, PHP 5)

imagecopyresampled -- 重采样拷贝部分图像并调整大小

说明

int imagecopyresampled ( resource dst_im, resource src_im, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH)

imagecopyresampled() 将一幅图像中的一块正方形区域拷贝到另一个图像中,平滑地插入像素值,因此,尤其是,减小了图像的大小而仍然保持了极大的清晰度。dst_imsrc_im 分别是目标图像和源图像的标识符。如果源和目标的宽度和高度不同,则会进行相应的图像收缩和拉伸。坐标指的是左上角。本函数可用来在同一幅图内部拷贝(如果 dst_imsrc_im 相同的话)区域,但如果区域交迭的话则结果不可预知。

注: 因为调色板图像限制(255+1 种颜色)有个问题。重采样或过滤图像通常需要多于 255 种颜色,计算新的被重采样的像素及其颜色时采用了一种近似值。对调色板图像尝试分配一个新颜色时,如果失败我们选择了计算结果最接近(理论上)的颜色。这并不总是视觉上最接近的颜色。这可能会产生怪异的结果,例如空白(或者视觉上是空白)的图像。要跳过这个问题,请使用真彩色图像作为目标图像,例如用 imagecreatetruecolor() 创建的。

注: imagecopyresampled() 需要 GD 2.0.l 或更高版本。

参见 imagecopyresized()




add a note add a note User Contributed Notes
imagecopyresampled
barnabas at kendall dot net
20-Aug-2001 07:28
As of PHP 4.0.6 (with GD 2.0.1), be aware that the srcX and srcY arguments are currently ignored, unlike ImageCopyResize. If you are resizing the whole image, then you probably won't use any source coordinates other than 0,0. But if you are resizing only a specific portion of the image, then be aware that ImageCopyResampled and ImageCopyResize are not (yet) interchangable, and you might want to stick with ImageCopyResize.

<imagecopymergegrayimagecopyresized>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22