lib/dragonfly_libvips/processors/rotate.rb in dragonfly_libvips-2.3.3 vs lib/dragonfly_libvips/processors/rotate.rb in dragonfly_libvips-2.4.0
- old
+ new
@@ -5,11 +5,11 @@
class Rotate
def call(content, rotate, options = {})
raise UnsupportedFormat unless content.ext
raise UnsupportedFormat unless SUPPORTED_FORMATS.include?(content.ext.downcase)
- options = options.each_with_object({}) { |(k, v), memo| memo[k.to_s] = v } # stringify keys
+ options = DragonflyLibvips.stringify_keys(options)
format = options.fetch('format', content.ext)
input_options = options.fetch('input_options', {})
# input_options['access'] ||= 'sequential'
@@ -24,14 +24,14 @@
output_options['profile'] ||= input_options.fetch('profile', EPROFILE_PATH)
end
output_options.delete('Q') unless format.to_s =~ /jpg|jpeg/i
output_options['format'] ||= format.to_s if format.to_s =~ /gif|bmp/i
- img = ::Vips::Image.new_from_file(content.path, input_options)
+ img = ::Vips::Image.new_from_file(content.path, DragonflyLibvips.symbolize_keys(input_options))
img = img.rot("d#{rotate}")
content.update(
- img.write_to_buffer(".#{format}", output_options),
+ img.write_to_buffer(".#{format}", DragonflyLibvips.symbolize_keys(output_options)),
'name' => "temp.#{format}",
'format' => format
)
content.ext = format
end