Sha256: cceb28e1fca83bfa25a8177bc25651e87b22f97586c321d7dcb89dbcc762eff8

Contents?: true

Size: 614 Bytes

Versions: 2

Compression:

Stored size: 614 Bytes

Contents

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

      # @return [String] a resize directive for imagemagick to use
      def to_imagemagick
        @width.to_s
      end

      attr_reader :width

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

Version data entries

2 entries across 2 versions & 1 rubygems

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