Sha256: 45cfff94129186c55844802395c6f4adcd7ecac25c394347d0a1a1f808ed9e4f

Contents?: true

Size: 507 Bytes

Versions: 14

Compression:

Stored size: 507 Bytes

Contents

require 'image_optim/worker'
require 'exifr'

class ImageOptim
  class Worker
    class Jhead < Worker
      def image_formats
        [:jpeg]
      end

      def run_order
        -10
      end

      def optimize(src, dst)
        if (2..8).include?(EXIFR::JPEG.new(src.to_s).orientation.to_i)
          src.copy(dst)
          args = %W[-autorot #{dst}]
          resolve_bin!(:jpegtran)
          execute(:jhead, *args) && dst.size?
        else
          false
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
image_optim-0.13.3 lib/image_optim/worker/jhead.rb
image_optim-0.13.2 lib/image_optim/worker/jhead.rb
image_optim-0.13.1 lib/image_optim/worker/jhead.rb
image_optim-0.13.0 lib/image_optim/worker/jhead.rb
image_optim-0.12.1 lib/image_optim/worker/jhead.rb
image_optim-0.12.0 lib/image_optim/worker/jhead.rb
image_optim-0.11.2 lib/image_optim/worker/jhead.rb
image_optim-0.11.1 lib/image_optim/worker/jhead.rb
image_optim-0.11.0 lib/image_optim/worker/jhead.rb
image_optim-0.10.2 lib/image_optim/worker/jhead.rb
image_optim-0.10.1 lib/image_optim/worker/jhead.rb
image_optim-0.10.0 lib/image_optim/worker/jhead.rb
image_optim-0.9.1 lib/image_optim/worker/jhead.rb
image_optim-0.9.0 lib/image_optim/worker/jhead.rb