Sha256: 7011358ad03dfa7c60a302b6f77ce19877dc1290fcfaa060c7c4502eaa7ef893

Contents?: true

Size: 577 Bytes

Versions: 12

Compression:

Stored size: 577 Bytes

Contents

module IIIF::Image
  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
      # @param [Integer] width
      def initialize(width)
        @width = width
      end

      attr_reader :width

      # @param ratio [Rational] the aspect ratio
      def height_for_aspect_ratio(ratio)
        (width / ratio).round
      end

      def to_s
        "#{width},"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
iiif-image-api-0.3.0 lib/iiif/image/size/width.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/iiif-image-api-0.2.0/lib/iiif/image/size/width.rb
iiif-image-api-0.2.0 lib/iiif/image/size/width.rb
iiif-image-api-0.1.0 lib/iiif/image/size/width.rb
iiif-image-api-0.0.8 lib/iiif/image/size/width.rb
iiif-image-api-0.0.7 lib/iiif/image/size/width.rb
iiif-image-api-0.0.6 lib/iiif/image/size/width.rb
iiif-image-api-0.0.5 lib/iiif/image/size/width.rb
iiif-image-api-0.0.4 lib/iiif/image/size/width.rb
iiif-image-api-0.0.3 lib/iiif/image/size/width.rb
iiif-image-api-0.0.2 lib/iiif/image/size/width.rb
iiif-image-api-0.0.1 lib/iiif/image/size/width.rb