Sha256: 6916eea5d3aaa53febec9a93d310d982708ffa1e994b2aa08bf380dd2c0a1dd8

Contents?: true

Size: 392 Bytes

Versions: 3

Compression:

Stored size: 392 Bytes

Contents

require 'tempfile'
require 'jpeg/version'
require 'jpeg/jpeg'
require 'jpeg/image'

module 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::Image.open(tmp.path)
    tmp.close
    jpeg
  end

  def self.open(file)
    Jpeg::Image.open(file)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jpeg-0.6.0 lib/jpeg.rb
jpeg-0.5.1 lib/jpeg.rb
jpeg-0.5.0 lib/jpeg.rb