Class: Riiif::Region::Imagemagick::AbsoluteDecoder

Inherits:
Object
  • Object
show all
Defined in:
app/services/riiif/region/imagemagick/absolute_decoder.rb

Overview

decodes requested cooridnates into an imagemagick crop directive

Instance Method Summary collapse

Constructor Details

#initialize(x, y, width, height) ⇒ AbsoluteDecoder

Returns a new instance of AbsoluteDecoder.



6
7
8
9
10
11
# File 'app/services/riiif/region/imagemagick/absolute_decoder.rb', line 6

def initialize(x, y, width, height)
  @x = x
  @y = y
  @width = width
  @height = height
end

Instance Method Details

#decodeString

Returns a region for imagemagick to decode (appropriate for passing to the -crop parameter).

Returns:

  • (String)

    a region for imagemagick to decode (appropriate for passing to the -crop parameter)



15
16
17
# File 'app/services/riiif/region/imagemagick/absolute_decoder.rb', line 15

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