Class: ImageOptim::Worker::Advpng

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

Overview

Constant Summary collapse

LEVEL_OPTION =
option(:level, 4, 'Compression level: '\
    '`0` - don\'t compress, '\
    '`1` - fast, '\
    '`2` - normal, '\
    '`3` - extra, '\
    '`4` - extreme') do |v|
  OptionHelpers.limit_with_range(v.to_i, 0..4)
end

Instance Method Summary collapse

Methods inherited from ImageOptim::Worker

#image_formats, #initialize, #inspect, #optimized?, #options, #resolve_used_bins!, #used_bins

Methods included from ClassMethods

#bin_sym, #create_all, #create_all_by_format, extended, #inherited, #klasses, #option, #option_definitions

Constructor Details

This class inherits a constructor from ImageOptim::Worker

Instance Method Details

#optimize(src, dst) ⇒ Object


22
23
24
25
26
27
28
29
30
31
32
# File 'lib/image_optim/worker/advpng.rb', line 22

def optimize(src, dst)
  src.copy(dst)
  args = %W[
    --recompress
    -#{level}
    --quiet
    --
    #{dst}
  ]
  execute(:advpng, *args) && optimized?(src, dst)
end

#run_orderObject


18
19
20
# File 'lib/image_optim/worker/advpng.rb', line 18

def run_order
  4
end