Class: ImageOptim::Worker::Jhead

Inherits:
ImageOptim::Worker show all
Defined in:
lib/image_optim/worker/jhead.rb

Instance Method Summary collapse

Methods inherited from ImageOptim::Worker

#<=>, bin_sym, inherited, #initialize, klasses, #optimized?, option, option_definitions

Constructor Details

This class inherits a constructor from ImageOptim::Worker

Instance Method Details

#image_formatsObject



7
8
9
# File 'lib/image_optim/worker/jhead.rb', line 7

def image_formats
  [:jpeg]
end

#optimize(src, dst) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/image_optim/worker/jhead.rb', line 15

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

#run_orderObject



11
12
13
# File 'lib/image_optim/worker/jhead.rb', line 11

def run_order
  -10
end