Method: ImageInspector::Image#getRawData
- Defined in:
- lib/imageinspector.rb
#getRawData ⇒ Object
Return image data (possibly compressed) for a previously initialized image as a sring. For JPEG and JPEG2000 this would be the whole image as it is stored on the disk, while for TIFF and PNG all headers are stripped and a raw data stream is returned.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/imageinspector.rb', line 106 def getRawData() raise "The image has not been properly initialized" if @width.nil? or @input.nil? begin if @input.kind_of? IO or @input.kind_of? StringIO ret = concatDataBlocks( @input ) else File.open( @input, 'rb' ) { |io| ret = concatDataBlocks( io ) } end return ret rescue Exception => e $stderr.puts( "Could not read data from #{@fname}: " << e. ) end end |