Class: Jpeg

Inherits:
Object
  • Object
show all
Defined in:
lib/jpeg.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.open_buffer(str) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/jpeg.rb', line 4

def self.open_buffer(str)
  tmp = Tempfile::new("ruby-jpeg")
  tmp.set_encoding Encoding::BINARY if tmp.respond_to?(:set_encoding)
  tmp.puts str
  tmp.rewind
  jpeg = Jpeg.open(tmp.path)
  tmp.close
  jpeg
end

Instance Method Details

#gray?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/jpeg.rb', line 18

def gray?
  color_info == :gray
end

#rgb?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/jpeg.rb', line 14

def rgb?
  color_info == :rgb
end