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, options = {}) ⇒ Object



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

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

#run_orderObject



20
21
22
# File 'lib/image_optim/worker/advpng.rb', line 20

def run_order
  4
end