Ruby 图形库
RMagic、ImageMagick、GD 等之间有什么区别,我应该使用哪一个?我正在寻找缩略图生成脚本,并注意到我找到的每个脚本都使用不同的库来完成同一件事。
What's the difference between RMagic, ImageMagick, GD, etc. and which one should I use? I was looking for a thumbnail generation script and noticed that every script I found uses a different library for the same thing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
Imagemagick、GD、DevIL 和 GraphicsMagick 是用于创建和编辑图像文件的库。 RMagick 是 ImageMagick/GraphicsMagick 的 ruby 包装器。您可能会发现其他包装器,
我很幸运地在我的 Mac 上安装和配置 GraphicsMagick(类似于 ImageMagick)并使用 RMagick。
你在做批处理吗?逻辑调整大小(固定 XY、最大 XY、减少百分比)怎么样?图像类型(png、jpg、gif、bmp)?与其他工具集成(Paperclip,如上所述)?您的服务器设置是什么(共享主机、可以安装库等)?
如果您提供有关缩略图生成需求和设置的更多详细信息,可能会帮助您获得更好的答案,但我建议至少尝试一下 GraphicsMagick 和 ImageMagick,以及 mini_magick 或 rmagick。不过,图像科学对我来说也很有趣......
Imagemagick, GD, DevIL, and GraphicsMagick are libraries used to create and edit image files. RMagick is a ruby wrapper around ImageMagick/GraphicsMagick. You may find other wrappers
I've had luck installing and configuring GraphicsMagick (similar to ImageMagick) and using RMagick on my Mac.
Are you doing batch processing? What about logical resizing (fixed XY, max XY, percent reduction)? Image types (png, jpg, gif, bmp)? Integration with other tools (Paperclip, as mentioned above)? What's your server setup (shared host, can install libraries, etc.)?
If you provide some more details on your thumbnail generation needs and your setup that might help give you a better answer, but I'd suggest giving at least GraphicsMagick and ImageMagick a try, along with mini_magick or rmagick. Imagescience sounds interesting to me too though...
如果可能的话,远离 ImageMagick,还有其他更轻量级的,ImageScience、DevIL 等
Stay away from ImageMagick if possible, there are other lighter weight ones, ImageScience, DevIL, and so on
我过去在 ImageScience 上运气不错,不过实际上 ImageMagick 并没有那么糟糕(如果很大的话),而且可能是共享主机上可用的。
I've had good luck with ImageScience in the past, though really ImageMagick isn't all that bad (if big), and might be what is available on shared hosting.
答案可能还取决于您使用的其他宝石。例如,如果您使用 Paperclip 上传文件,那么最好使用 ImageMagick,因为这是 Paperclip 用来处理文件的库。
The answer might also depend on what other gems you are using. For example, if you use Paperclip for uploading files then it would be better to use ImageMagick as that is the library that Paperclip uses to process files.
如果我是你,我会远离 Rmagick/Imagemagick。我在 Rails 应用程序中也有类似的需求,以图表形式显示用户的活动。我尝试让 Gruff/Scruffy 都工作但失败了,两者都依赖于 Rmagick。我最终放弃并使用 jQuery/Flot,它生成了漂亮的图表。
If I were you, I would stay away from Rmagick/Imagemagick. I had a similar need in my rails application, to show the activity of user as a graph. I tried and failed to get both Gruff/Scruffy working, both depend on Rmagick. I finally gave up and used jQuery/Flot and it produces beautiful graphs.