Module: Axon

Defined in:
lib/axon.rb,
lib/axon/fit.rb,
lib/axon/solid.rb,
lib/axon/scaler.rb,
lib/axon/cropper.rb,
lib/axon/png_writer.rb,
lib/axon/jpeg_writer.rb,
lib/axon/bilinear_scaler.rb,
lib/axon/nearest_neighbor_scaler.rb,
ext/axon/png_common.c,
ext/axon/png_reader.c,
ext/axon/jpeg_common.c,
ext/axon/jpeg_reader.c,
ext/axon/png_native_writer.c,
ext/axon/jpeg_native_writer.c,
ext/axon/bilinear_interpolation.c,
ext/axon/nearest_neighbor_interpolation.c

Defined Under Namespace

Modules: BilinearScaling, Image, JPEGNativeWriter, NearestNeighborScaling, PNGNativeWriter Classes: BilinearScaler, Cropper, Fit, JPEGReader, JPEGWriter, NearestNeighborScaler, PNGReader, PNGWriter, Scaler, Solid

Constant Summary collapse

VERSION =
'0.0.2'

Class Method Summary collapse

Class Method Details

.JPEG(thing, markers = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/axon.rb', line 16

def self.JPEG(thing, markers=nil)
  if thing.respond_to? :read
    io = thing
    rewind_after_scanlines = false
  elsif thing[0, 1] == "\xFF"
    io = StringIO.new(thing)
    rewind_after_scanlines = true
  else
    io = File.open(thing)
    rewind_after_scanlines = true
  end

  JPEGReader.new(io, markers, rewind_after_scanlines)
end

.PNG(thing) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/axon.rb', line 31

def self.PNG(thing)
  if thing.respond_to? :read
    io = thing
    rewind_after_scanlines = false
  elsif thing[0, 1] == "\x89"
    io = StringIO.new(thing)
    rewind_after_scanlines = true
  else
    io = File.open(thing)
    rewind_after_scanlines = true
  end

  PNGReader.new(io)
end