创建缩略图最有效的方法?
我有大量的缩略图要做。目前,我正在使用 ImageMagick,但事实证明它效率太低(太慢,使用太多 CPU/内存等)。
我已经开始评估 GraphicsMagick,我希望从中得到“哇”的结果。我没有得到它们。有人可以快速浏览一下我的基准测试脚本(仅进行简单的速度和文件大小比较;尚未检查 CPU 和内存):
这是我得到的示例输出:
'gm convert' took 75.0039 seconds to execute 10 iteration(s).
'convert' took 83.1421 seconds to execute 10 iteration(s).
Average filesize of gm convert: 144,588 bytes.
Average filesize of convert: 81,194 bytes.
GraphicsMagick 并没有那么快——而且输出的文件大小明显大于 ImageMagick。
I have a huge volume of thumbnailing to do. Currently, I am using ImageMagick, but it's proving too inefficient (it's too slow, uses too much CPU/memory, etc.).
I have started to evaluate GraphicsMagick, which I expected to get "wow" results from. I didn't get them. Can someone take a quick look at my benchmark script (does simple speed and file size comparison only; no CPU and memory checks yet):
Here's a sample output I got:
'gm convert' took 75.0039 seconds to execute 10 iteration(s).
'convert' took 83.1421 seconds to execute 10 iteration(s).
Average filesize of gm convert: 144,588 bytes.
Average filesize of convert: 81,194 bytes.
GraphicsMagick is not that much faster -- and the outputted file sizes are SIGNIFICANTLY higher than ImageMagick.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议你使用ExactImage。根据基准测试,它比 ImageMagick 更快。
I'd suggest you to use ExactImage. According to the benchmarks it is faster than the ImageMagick.
我想用GD2,试试我用的这个功能。它非常容易使用:
I you want to use GD2, try this function I use. It's pretty easy to use:
我假设您有某种需要拇指的图像队列,并且您的应用程序可以通过它们工作?您可以考虑将一些工作转移到 EC2 之类的东西上。如果您的队列超过一定大小,则会启动预先准备的 EC2 实例来处理负载。如果队列很大,您甚至可以启动多台机器。
您不需要始终运行这些实例 - 仅当您自己的服务器无法处理负载时才需要它们。
显然,您需要预测您的成本,看看是否值得,但考虑到您只需为使用的时间付费,并且价格从 8.5 美分/小时起,这可能足以满足您的需求。
I assume you have some sort of queue of images that require thumbs and your app works through them? You could look at siphoning off some of the work to something like EC2. If your queue gets over a certain size fire up a pre-prepared EC2 instance to process the load instead. You could even fire up several machines if the queue was massive.
You don't need these instances to run all the time - you only need them when your own server isn't able to handle the load.
Obviously you'd need to forecast your costs to see if it was worth it but given you only pay for the time you use and the prices start at 8.5c/hour it might be economical enough for your needs.