Class: ImageRuby::Encoder
Defined Under Namespace
Classes: UnableToEncodeException
Class Method Summary collapse
-
.encode(image, format, output) ⇒ Object
encode a image with the given format writing the binary data to the output output can be a string or a open file on binary mode raises UnableToEncodeException if the specified format is unknown.
Class Method Details
.encode(image, format, output) ⇒ Object
encode a image with the given format writing the binary data to the output output can be a string or a open file on binary mode raises UnableToEncodeException if the specified format is unknown
To save a image to a file on disk use the method Image#save
Example
output = String.new
Encoder.encode(image,:bmp,output)
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/imageruby/encoder.rb', line 41 def self.encode(image,format,output) Encoder.each_subclass do |sc| encoder = sc.new begin return encoder.encode(image,format,output) rescue UnableToEncodeException end end raise UnableToEncodeException end |