Search code examples
rubyimagemagickrmagick

Interlaced Image with RMagick


ImageMagick has an interlace option, which RMagick supports, but I can't work out the syntax for this. I can see Magick::InterlaceType and Magick::LineInterlace are both valid constants, but how to save an image using those constants?


Solution

  • require 'rubygems'
    require 'RMagick'
    
    img = Magick::Image.new(300, 50) do
      self.background_color = '#FFFF00'
    end
    img.write('test.jpg') { self.interlace = Magick::PlaneInterlace }
    
    #check the interlace property
    puts img.interlace # PlaneInterlace