Module: Image

Defined in:
lib/image.rb

Overview

Build browserconfig XML

Class Method Summary collapse

Class Method Details

.basic_options(convert, options) ⇒ Object



18
19
20
21
22
23
# File 'lib/image.rb', line 18

def self.basic_options(convert, options)
  convert.background options[:background] if options[:background]
  convert.define options[:define] if options[:define]
  convert.density options[:density] if options[:density]
  convert.alpha options[:alpha] if options[:alpha]
end

.convert(source, output, options = {}) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/image.rb', line 3

def self.convert(source, output, options = {})
  MiniMagick::Tool::Convert.new do |convert|
    options_for convert, options
    convert << source
    convert << output
  end
end

.odd_options(convert, options) ⇒ Object



29
30
31
32
# File 'lib/image.rb', line 29

def self.odd_options(convert, options)
  convert.gravity 'center' if options[:odd]
  convert.extent options[:resize] if options[:odd] && options[:resize]
end

.options_for(convert, options) ⇒ Object



11
12
13
14
15
16
# File 'lib/image.rb', line 11

def self.options_for(convert, options)
  convert.flatten
  basic_options convert, options
  resize_options convert, options
  odd_options convert, options
end

.resize_options(convert, options) ⇒ Object



25
26
27
# File 'lib/image.rb', line 25

def self.resize_options(convert, options)
  convert.resize options[:resize] if options[:resize]
end