Ruby/Rails image processing libraries

后端 未结 6 2197
深忆病人
深忆病人 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条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-28 19:30

    I wrote something like the following:

    require 'rubygems'
    require 'RMagick'
    include Magick
    
    image = Image.new(50, 50) {
      self.background_color = "white"
    }
    text = Draw.new
    text.annotate(image, 0,0,0,40, 'Named Colors') {
         self.fill = 'black'
         self.pointsize = 32
    }
    image.write("image.png")
    

    Which should be easy enough to follow. Also have a look at the documentation. Whilst it's not quite laid out to perfection, it's pretty much all there.

提交回复
热议问题