Sha256: 1615c0659c2feaae3f3571803a614ac3bdc28a3592cc6c4d255128740519b878
Contents?: true
Size: 894 Bytes
Versions: 1
Compression:
Stored size: 894 Bytes
Contents
require 'vips' module DragonflyLibvips module Analysers class ImageProperties DPI = 300 def call(content) return {} unless SUPPORTED_FORMATS.include?(content.ext) input_options = {} input_options['access'] = 'sequential' input_options['autorotate'] = true if content.mime_type == 'image/jpeg' input_options['dpi'] = DPI if content.mime_type == 'application/pdf' img = ::Vips::Image.new_from_file(content.path, input_options) width = img.width height = img.height xres = img.xres yres = img.yres { 'format' => content.ext.to_s, 'width' => width, 'height' => height, 'xres' => xres, 'yres' => yres, 'progressive' => (content.mime_type == 'image/jpeg' && img.get('jpeg-multiscan') != 0) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dragonfly_libvips-2.3.0 | lib/dragonfly_libvips/analysers/image_properties.rb |