Class: Miso::Image
- Inherits:
-
Object
- Object
- Miso::Image
- Defined in:
- lib/miso/image.rb,
lib/miso/factory.rb
Instance Attribute Summary collapse
-
#processor ⇒ Object
readonly
Returns the value of attribute processor.
Class Method Summary collapse
- .auto_orient(input_file, output_file, processor_class = nil) ⇒ Object
-
.crop(input_file, output_file, width, height, processor_class = nil) ⇒ Object
Class shortcut methods.
- .dimensions(input_file, processor_class = nil) ⇒ Object
- .factory(processor_class = Processor.processor_class) ⇒ Object
- .fit(input_file, output_file, width, height, processor_class = nil) ⇒ Object
Instance Method Summary collapse
- #auto_orient ⇒ Object
-
#crop(width, height) ⇒ Object
Basic methods.
-
#crop_fitting(width, height) ⇒ Object
Combined methods.
- #dimensions ⇒ Object
- #fit(width, height) ⇒ Object
- #height ⇒ Object
-
#initialize(input_file, processor_class = nil) ⇒ Image
constructor
A new instance of Image.
- #width ⇒ Object
- #write(output_file) ⇒ Object
Constructor Details
#initialize(input_file, processor_class = nil) ⇒ Image
Returns a new instance of Image.
5 6 7 8 |
# File 'lib/miso/image.rb', line 5 def initialize(input_file, processor_class=nil) processor_class ||= Processor.processor_class @processor = processor_class.new(input_file) end |
Instance Attribute Details
#processor ⇒ Object (readonly)
Returns the value of attribute processor.
3 4 5 |
# File 'lib/miso/image.rb', line 3 def processor @processor end |
Class Method Details
.auto_orient(input_file, output_file, processor_class = nil) ⇒ Object
60 61 62 |
# File 'lib/miso/image.rb', line 60 def self.auto_orient(input_file, output_file, processor_class = nil) new(input_file, processor_class).auto_orient.write(output_file) end |
.crop(input_file, output_file, width, height, processor_class = nil) ⇒ Object
Class shortcut methods
52 53 54 |
# File 'lib/miso/image.rb', line 52 def self.crop(input_file, output_file, width, height, processor_class = nil) new(input_file, processor_class).crop(width, height).write(output_file) end |
.dimensions(input_file, processor_class = nil) ⇒ Object
64 65 66 |
# File 'lib/miso/image.rb', line 64 def self.dimensions(input_file, processor_class = nil) new(input_file, processor_class).dimensions end |
.factory(processor_class = Processor.processor_class) ⇒ Object
3 4 5 |
# File 'lib/miso/factory.rb', line 3 def self.factory(processor_class = Processor.processor_class) Factory.new(processor_class) end |
.fit(input_file, output_file, width, height, processor_class = nil) ⇒ Object
56 57 58 |
# File 'lib/miso/image.rb', line 56 def self.fit(input_file, output_file, width, height, processor_class = nil) new(input_file, processor_class).fit(width, height).write(output_file) end |
Instance Method Details
#auto_orient ⇒ Object
22 23 24 25 |
# File 'lib/miso/image.rb', line 22 def auto_orient @processor.auto_orient return self end |
#crop(width, height) ⇒ Object
Basic methods
12 13 14 15 |
# File 'lib/miso/image.rb', line 12 def crop(width, height) @processor.crop(width, height) return self end |
#crop_fitting(width, height) ⇒ Object
Combined methods
46 47 48 |
# File 'lib/miso/image.rb', line 46 def crop_fitting(width, height) fit(width, height).crop(width, height) end |
#dimensions ⇒ Object
27 28 29 |
# File 'lib/miso/image.rb', line 27 def dimensions @processor.dimensions end |
#fit(width, height) ⇒ Object
17 18 19 20 |
# File 'lib/miso/image.rb', line 17 def fit(width, height) @processor.fit(width, height) return self end |
#height ⇒ Object
35 36 37 |
# File 'lib/miso/image.rb', line 35 def height @processor.height end |
#width ⇒ Object
31 32 33 |
# File 'lib/miso/image.rb', line 31 def width @processor.width end |
#write(output_file) ⇒ Object
39 40 41 42 |
# File 'lib/miso/image.rb', line 39 def write(output_file) @processor.write(output_file) self.class.new(output_file, @processor.class) end |