RMagick: Get a list of available formats
With RMagick, is there any way to get a开发者_如何学Python list of all the available image formats for writing to? I want to fill a <select>
tag with all of the different writable formats.
Ruby 1.9.2
Magick.formats.select {|image_format, mode_string| mode_string.include? 'w' }.keys.each do |image_format|
puts image_format
end
Relevant Source for RMagick
https://github.com/rmagick/rmagick/blob/master/lib/RMagick.rb#L19
Mode String Information for RMagick
http://www.google.com/codesearch/p?hl=en#q35x35fKNI0/pub/distfiles/ruby/RMagick-1.7.0.tar.gz%7CYe7iosFBC-s/RMagick-1.7.0/ext/RMagick/rmmain.c&l=239
精彩评论