Class: Riiif::Region::Imagemagick::PercentageDecoder
- Inherits:
-
Object
- Object
- Riiif::Region::Imagemagick::PercentageDecoder
- Defined in:
- app/services/riiif/region/imagemagick/percentage_decoder.rb
Overview
decodes requested cooridnates into an imagemagick crop directive
Instance Method Summary collapse
-
#decode ⇒ String
Imagemagick can’t do percentage offsets, so we have to calculate it.
-
#initialize(image_info, x, y, width, height) ⇒ PercentageDecoder
constructor
A new instance of PercentageDecoder.
Constructor Details
#initialize(image_info, x, y, width, height) ⇒ PercentageDecoder
Returns a new instance of PercentageDecoder.
6 7 8 9 10 11 12 |
# File 'app/services/riiif/region/imagemagick/percentage_decoder.rb', line 6 def initialize(image_info, x, y, width, height) @image_info = image_info @x = x @y = y @width = width @height = height end |
Instance Method Details
#decode ⇒ String
Imagemagick can’t do percentage offsets, so we have to calculate it
17 18 19 |
# File 'app/services/riiif/region/imagemagick/percentage_decoder.rb', line 17 def decode "#{@width}%x#{@height}+#{offset_x}+#{offset_y}" end |