Sha256: 65c28ae69ddb644195002820c16e402d50c2bebaad4095c3c73c9a48f26e4a36

Contents?: true

Size: 368 Bytes

Versions: 1

Compression:

Stored size: 368 Bytes

Contents

require 'tempfile'
require 'jpeg/jpeg'

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

1 entries across 1 versions & 1 rubygems

Version Path
jpeg-0.4.0 lib/jpeg.rb