Class: Riiif::ImagemagickCommandFactory
- Inherits:
-
Object
- Object
- Riiif::ImagemagickCommandFactory
- Defined in:
- app/services/riiif/imagemagick_command_factory.rb
Overview
Builds a command to run a transformation using Imagemagick
Instance Attribute Summary collapse
-
#compression ⇒ Object
readonly
Returns the value of attribute compression.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#sampling_factor ⇒ Object
readonly
Returns the value of attribute sampling_factor.
-
#strip_metadata ⇒ Object
readonly
Returns the value of attribute strip_metadata.
-
#transformation ⇒ Object
readonly
Returns the value of attribute transformation.
Class Method Summary collapse
-
.build(path, transformation, compression: 85, sampling_factor: '4:2:0', strip_metadata: true) ⇒ String
A helper method to instantiate and invoke build.
Instance Method Summary collapse
-
#build ⇒ String
A command for running imagemagick to produce the requested output.
-
#initialize(path, transformation, compression:, sampling_factor:, strip_metadata:) ⇒ ImagemagickCommandFactory
constructor
A helper method to instantiate and invoke build.
Constructor Details
#initialize(path, transformation, compression:, sampling_factor:, strip_metadata:) ⇒ ImagemagickCommandFactory
A helper method to instantiate and invoke build
24 25 26 27 28 29 30 |
# File 'app/services/riiif/imagemagick_command_factory.rb', line 24 def initialize(path, transformation, compression:, sampling_factor:, strip_metadata:) @path = path @transformation = transformation @compression = compression @sampling_factor = sampling_factor @strip_metadata = end |
Instance Attribute Details
#compression ⇒ Object (readonly)
Returns the value of attribute compression.
32 33 34 |
# File 'app/services/riiif/imagemagick_command_factory.rb', line 32 def compression @compression end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
32 33 34 |
# File 'app/services/riiif/imagemagick_command_factory.rb', line 32 def path @path end |
#sampling_factor ⇒ Object (readonly)
Returns the value of attribute sampling_factor.
32 33 34 |
# File 'app/services/riiif/imagemagick_command_factory.rb', line 32 def sampling_factor @sampling_factor end |
#strip_metadata ⇒ Object (readonly)
Returns the value of attribute strip_metadata.
32 33 34 |
# File 'app/services/riiif/imagemagick_command_factory.rb', line 32 def @strip_metadata end |
#transformation ⇒ Object (readonly)
Returns the value of attribute transformation.
32 33 34 |
# File 'app/services/riiif/imagemagick_command_factory.rb', line 32 def transformation @transformation end |
Class Method Details
.build(path, transformation, compression: 85, sampling_factor: '4:2:0', strip_metadata: true) ⇒ String
A helper method to instantiate and invoke build
13 14 15 16 17 18 |
# File 'app/services/riiif/imagemagick_command_factory.rb', line 13 def self.build(path, transformation, compression: 85, sampling_factor: '4:2:0', strip_metadata: true) new(path, transformation, compression: compression, sampling_factor: sampling_factor, strip_metadata: ).build end |
Instance Method Details
#build ⇒ String
Returns a command for running imagemagick to produce the requested output.
35 36 37 |
# File 'app/services/riiif/imagemagick_command_factory.rb', line 35 def build [command, crop, size, rotation, colorspace, quality, sampling, , output].join end |