Class: Riiif::Size::Imagemagick::BestFitDecoder

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

Overview

The image content is scaled for the best fit such that the resulting width and height are less than or equal to the requested width and height.

Instance Method Summary collapse

Constructor Details

#initialize(width, height) ⇒ BestFitDecoder

Returns a new instance of BestFitDecoder.



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

def initialize(width, height)
  @width = width
  @height = height
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/best_fit_decoder.rb', line 13

def decode
  "#{@width}x#{@height}"
end