Class: ImageOptim::Worker::Pngout
- Inherits:
-
ImageOptim::Worker
- Object
- ImageOptim::Worker
- ImageOptim::Worker::Pngout
- Defined in:
- lib/image_optim/worker/pngout.rb
Overview
Constant Summary collapse
- COPY_CHUNKS_OPTION =
option(:copy_chunks, false, 'Copy optional chunks'){ |v| !!v }
- STRATEGY_OPTION =
option(:strategy, 0, 'Strategy: ' \ '`0` - xtreme, ' \ '`1` - intense, ' \ '`2` - longest Match, ' \ '`3` - huffman Only, ' \ '`4` - uncompressed') 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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/image_optim/worker/pngout.rb', line 27 def optimize(src, dst, = {}) args = %W[ -k#{copy_chunks ? 1 : 0} -s#{strategy} -q -y #{src} #{dst} ] execute(:pngout, args, ) && optimized?(src, dst) rescue SignalException => e raise unless Signal.list.key(e.signo) == 'SEGV' raise unless resolve_bin!(:pngout).version <= '20150920' warn "pngout caused Segmentation fault for #{src}" end |
#run_order ⇒ Object
23 24 25 |
# File 'lib/image_optim/worker/pngout.rb', line 23 def run_order 2 end |