Sha256: 60646453318788efc3ec23fdb35a0f3b761b7a13ff670103333a5b75d071c812

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

module Riiif
  module Size
    # The image or region should be scaled so that its height is exactly equal
    # to the provided parameter, and the width will be a calculated value that
    # maintains the aspect ratio of the extracted region
    class Height < Resize
      def initialize(info, height)
        @image_info = info
        @height = height.to_i
      end

      # @return [String] a resize directive for imagemagick to use
      def to_imagemagick
        "x#{@height}"
      end

      def width
        height * image_info.width / image_info.height
      end

      attr_reader :height
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
riiif-2.0.0.beta2 app/services/riiif/size/height.rb
riiif-2.0.0.beta1 app/services/riiif/size/height.rb