Ruby graphic libraries

半城伤御伤魂 提交于 2019-12-21 20:37:33

问题


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.


回答1:


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...




回答2:


Stay away from ImageMagick if possible, there are other lighter weight ones, ImageScience, DevIL, and so on




回答3:


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.




回答4:


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.




回答5:


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.



来源:https://stackoverflow.com/questions/3323287/ruby-graphic-libraries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!