Module: Imogen::Zoomable

Defined in:
lib/imogen/zoomable.rb

Class Method Summary collapse

Class Method Details

.convert(img, dest_path) ⇒ Object



14
15
16
# File 'lib/imogen/zoomable.rb', line 14

def self.convert(img, dest_path)
  raise "jp2 output conversion not implemented"
end

.levels_for(*dims) ⇒ Object

levels for width,height, tile_size=128



8
9
10
11
12
13
# File 'lib/imogen/zoomable.rb', line 8

def self.levels_for(*dims)
  max = dims[0..1].max || 0
  return 0 if max == 0
  tile_size = dims[2] || 128
  return Math.log2(dims[0..1].max.to_f / tile_size).ceil
end

.max_levels_for(*dims) ⇒ Object

levels for hypothetical 1x1 tiles



4
5
6
# File 'lib/imogen/zoomable.rb', line 4

def self.max_levels_for(*dims)
  return Math.log2(dims[0..1].max).ceil
end