Class: Jpeg

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

Constant Summary collapse

VERSION =
"0.4.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.open_buffer(str) ⇒ Object



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

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)


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

def gray?
  color_info == :gray
end

#rgb?Boolean

Returns:

  • (Boolean)


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

def rgb?
  color_info == :rgb
end