Class: Riiif::VipsTransformer
- Inherits:
-
AbstractTransformer
- Object
- AbstractTransformer
- Riiif::VipsTransformer
- Includes:
- ActiveSupport::Benchmarkable
- Defined in:
- app/transformers/riiif/vips_transformer.rb
Instance Attribute Summary collapse
-
#compression ⇒ Object
readonly
Returns the value of attribute compression.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#strip_metadata ⇒ Object
readonly
Returns the value of attribute strip_metadata.
-
#subsample ⇒ Object
readonly
Returns the value of attribute subsample.
Attributes inherited from AbstractTransformer
Instance Method Summary collapse
-
#initialize(path, image_info, transformation, compression: 85, subsample: true, strip_metadata: true) ⇒ VipsTransformer
constructor
A new instance of VipsTransformer.
-
#transform ⇒ String
All the image data.
Methods inherited from AbstractTransformer
Constructor Details
#initialize(path, image_info, transformation, compression: 85, subsample: true, strip_metadata: true) ⇒ VipsTransformer
Returns a new instance of VipsTransformer.
15 16 17 18 19 20 21 |
# File 'app/transformers/riiif/vips_transformer.rb', line 15 def initialize(path, image_info, transformation, compression: 85, subsample: true, strip_metadata: true) super(path, image_info, transformation) @image = ::Vips::Image.new_from_file(path.to_s) @compression = compression @subsample = subsample @strip_metadata = end |
Instance Attribute Details
#compression ⇒ Object (readonly)
Returns the value of attribute compression.
23 24 25 |
# File 'app/transformers/riiif/vips_transformer.rb', line 23 def compression @compression end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
23 24 25 |
# File 'app/transformers/riiif/vips_transformer.rb', line 23 def image @image end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
23 24 25 |
# File 'app/transformers/riiif/vips_transformer.rb', line 23 def path @path end |
#strip_metadata ⇒ Object (readonly)
Returns the value of attribute strip_metadata.
23 24 25 |
# File 'app/transformers/riiif/vips_transformer.rb', line 23 def @strip_metadata end |
#subsample ⇒ Object (readonly)
Returns the value of attribute subsample.
23 24 25 |
# File 'app/transformers/riiif/vips_transformer.rb', line 23 def subsample @subsample end |
Instance Method Details
#transform ⇒ String
Returns all the image data.
26 27 28 29 30 |
# File 'app/transformers/riiif/vips_transformer.rb', line 26 def transform benchmark("Riiif transformed image using vips") do transform_image.write_to_buffer(".#{format}#{}") end end |