Class: ImageOptim::Worker::Jpegtran

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

Instance Method Summary collapse

Methods inherited from ImageOptim::Worker

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

Constructor Details

This class inherits a constructor from ImageOptim::Worker

Instance Method Details

#optimize(src, dst) ⇒ Object



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

def optimize(src, dst)
  if jpegrescan
    args = %W[#{src} #{dst}]
    args.unshift '-s' unless copy_chunks
    resolve_bin!(:jpegtran)
    execute(:jpegrescan, *args) && optimized?(src, dst)
  else
    args = %W[-optimize -outfile #{dst} #{src}]
    args.unshift '-copy', copy_chunks ? 'all' : 'none'
    args.unshift '-progressive' if progressive
    execute(:jpegtran, *args) && optimized?(src, dst)
  end
end