php ImageMagick 与 GD - 哪个更快、资源占用更少并产生更好的图像?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8319203/
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
ImageMagick vs GD - which is faster, less resource intensive and produces better images?
提问by TK123
I need to choose between either ImageMagick or GD library for the following image manipulation tasks:
对于以下图像处理任务,我需要在 ImageMagick 或 GD 库之间进行选择:
- resizing images into multiple sizes
- watermarking images
- 将图像调整为多种尺寸
- 水印图像
As you can see I don't need anything fancy. I'm sure both these tools can achieve them, so if one has more extra features than the other, I don't really care about.
正如你所看到的,我不需要任何花哨的东西。我相信这两个工具都可以实现它们,所以如果一个工具比另一个有更多的额外功能,我真的不在乎。
My main concern is performance and quality. Which of these 2 tools consumes less resources, is faster and produces better quality images?
我主要关心的是性能和质量。这两种工具中哪一种消耗更少的资源,速度更快,产生的图像质量更好?
P.S. I need to use it with their respective PHP APIs.
PS 我需要将它与他们各自的 PHP API 一起使用。
采纳答案by simshaun
I would lean towards ImageMagick as far as image quality goes. It seems to produce considerably sharper/higher-quality images than GD2 (at the expense of larger filesize.)
就图像质量而言,我倾向于 ImageMagick。它似乎产生了比 GD2 更清晰/质量更高的图像(以更大的文件大小为代价。)
ImageMagick is also not bound by PHP's memory limit.
ImageMagick 也不受 PHP 内存限制的限制。
回答by Pekka
If in doubt, use ImageMagick. I haven't observed any big differences in speed and resource usage, but IM is way more flexible, better in quality in many areas (although you can expect decent results in watermarking from both libraries), and supports waymore formats.
如果有疑问,请使用 ImageMagick。我还没有看到在速度和资源使用任何大的差异,但IM的方式更加灵活,更好地在许多领域的质量(虽然你可以期望从两个库水印像样的成绩),并支持的方式更多的格式。
Many advanced operations that are complex or impossible to achieve with GD are easy to do with ImageMagick.
许多使用 GD 难以实现或无法实现的高级操作都可以通过 ImageMagick 轻松完成。
On the other hand, ImageMagick is not supported as well as GD by many hosting providers, so you'd be adding a sizeable dependency. Depending on the nature of your project, that may or may not be a problem.
另一方面,许多托管服务提供商不支持 ImageMagick 以及 GD,因此您将添加相当大的依赖项。根据您项目的性质,这可能是也可能不是问题。
回答by Xeoncross
I have built GD and ImageMagick libraries. Both work just fine and produce the same size images if used right. However, ImageMagic comes with a lot more options out of the box and is what I lean towards now.
我已经构建了 GD 和 ImageMagick 库。如果使用得当,两者都可以正常工作并产生相同大小的图像。然而,ImageMagic 提供了更多开箱即用的选项,这也是我现在倾向于使用的。
In addition, ImageMagick works great as a stand-alone for bash scripting or another terminal functions which means what you learn is useful outside of PHP.
此外,ImageMagick 作为 bash 脚本或其他终端功能的独立运行非常出色,这意味着您所学的内容在 PHP 之外很有用。