Sha256: 6848430305a7471eb520d40ee607911a773680ac036f8ad605d28494f28928a6
Contents?: true
Size: 704 Bytes
Versions: 14
Compression:
Stored size: 704 Bytes
Contents
module Riiif module Region module Imagemagick # decodes requested cooridnates into an imagemagick crop directive class SquareDecoder def initialize(image_info) @image_info = image_info end # @return [String] a square region for imagemagick to decode # (appropriate for passing to the -crop parameter) def decode min, max = [@image_info.width, @image_info.height].minmax offset = (max - min) / 2 if @image_info.height >= @image_info.width "#{min}x#{min}+0+#{offset}" else "#{min}x#{min}+#{offset}+0" end end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems