php imagecopyresized vs imagecopyresampled vs imagecopy 优点/缺点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18004702/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
php imagecopyresized vs imagecopyresampled vs imagecopy pros/cons
提问by seamus
These all seem to do the same thing. What are the pros/cons of each.
这些似乎都在做同样的事情。每个的优点/缺点是什么。
imagecopyresized() vs imagecopyresampled() vs imagecopy().
imagecopyresized() 与 imagecopyresampled() 与 imagecopy()。
I'm resizing a user submitted image.
我正在调整用户提交的图像的大小。
So I have an image shell created with '$newImage=imagecreatetruecolor(250, 250)'.
所以我有一个用 '$newImage=imagecreatetruecolor(250, 250)' 创建的图像外壳。
And now I want to copy the orginal image into the '$newImage'
现在我想将原始图像复制到“$newImage”中
回答by Orangepill
imagecopyresizedwill copy and scale and image. This uses a fairly primitive algorithm that tends to yield more pixelated results.
imagecopyresized将复制和缩放和图像。这使用了一种相当原始的算法,该算法往往会产生更多像素化的结果。
imagecopyresampledwill copy and scale and image, it uses a smoothing and pixel interpolating algorithm that will generally yield much better results then imagecopyresized at the cost of a little cpu usage.
imagecopyresampled将复制和缩放和图像,它使用平滑和像素插值算法,通常会产生比 imagecopyresized 更好的结果,但会占用少量 CPU。
imagecopywill copy but will not scale the image.
imagecopy将复制但不会缩放图像。