Class: Riiif::Size::Imagemagick::PercentDecoder

Inherits:
Object
  • Object
show all
Defined in:
app/services/riiif/size/imagemagick/percent_decoder.rb

Overview

The width and height of the returned image is scaled to n% of the width and height of the extracted region. The aspect ratio of the returned image is the same as that of the extracted region.

Instance Method Summary collapse

Constructor Details

#initialize(n) ⇒ PercentDecoder

Returns a new instance of PercentDecoder.



8
9
10
# File 'app/services/riiif/size/imagemagick/percent_decoder.rb', line 8

def initialize(n)
  @n = n
end

Instance Method Details

#decodeString

Returns a resize directive for imagemagick to use.

Returns:

  • (String)

    a resize directive for imagemagick to use



13
14
15
# File 'app/services/riiif/size/imagemagick/percent_decoder.rb', line 13

def decode
  "#{@n}%"
end