Sha256: 65493a1e184db600c91120db236970ae01e8a747fc8770b72192c03dc53671fb
Contents?: true
Size: 841 Bytes
Versions: 3
Compression:
Stored size: 841 Bytes
Contents
require 'image_optim/worker' require 'exifr' class ImageOptim class Worker # http://www.sentex.net/~mwandel/jhead/ # # Jhead internally uses jpegtran which should be on path class Jhead < Worker # Works on jpegs def image_formats [:jpeg] end # Run first, while exif is still present def run_order -10 end def used_bins [:jhead, :jpegtran] end def optimize(src, dst) return false unless oriented?(src) src.copy(dst) args = %W[ -autorot #{dst} ] resolve_bin!(:jpegtran) execute(:jhead, *args) && dst.size? end private def oriented?(image) exif = EXIFR::JPEG.new(image.to_s) (2..8).include?(exif.orientation.to_i) end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
image_optim-0.22.0 | lib/image_optim/worker/jhead.rb |
openstreetmap-image_optim-0.21.0.1 | lib/image_optim/worker/jhead.rb |
image_optim-0.21.0 | lib/image_optim/worker/jhead.rb |