Sha256: 79cf41da9a93b44ad2e46a68b8e3e1392f1b606f60d0227844ada1ac6eb666c4

Contents?: true

Size: 365 Bytes

Versions: 4

Compression:

Stored size: 365 Bytes

Contents

require 'tempfile'
require 'jpeg.so'
class Jpeg
  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

  def rgb?
    color_info == :rgb
  end

  def gray?
    color_info == :gray
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jpeg-0.3.3 lib/jpeg.rb
jpeg-0.3.2 lib/jpeg.rb
jpeg-0.3.1 lib/jpeg.rb
jpeg-0.3.0 lib/jpeg.rb