Ruby/Rails image processing libraries

后端 未结 6 2198
深忆病人
深忆病人 2020-12-28 18:35

Good friends of stackoverflow, I am here today for guidance regarding image processing/manipulation using Ruby in a Rails environment. I\'m creating on-the-fly dynamic banne

6条回答
  •  -上瘾入骨i
    2020-12-28 19:32

    Recently I have been experimenting with creating charts/graphs from data sets using Ruby. When I was unable to find any libraries or gems that really did what I wanted, I started tinkering around with SVG graphics and I found that they are actually fairly simple to create. The SVG format is simply plain-text XML. I built an SVG image in Inkscape, saved it to a plain SVG file, and my Ruby script uses that file as a template (I dynamically update a few line elements and several text labels and leave the structure of the file intact). SVG gives you all sorts of font options (like CSS or HTML).

    These two tutorials give you a quick look at SVG and how you can build an image fairly quickly with any app or language that can write to a text file. Ruby can use plain old puts to build a SVG file, or you can let the 'builder' gem do the formatting for you.

提交回复
热议问题