Sha256: f178299d8eea504903dcd51a6838d7d6716d607189355e65670fda5531ce4df1

Contents?: true

Size: 646 Bytes

Versions: 5

Compression:

Stored size: 646 Bytes

Contents

require 'image_optim/worker'
require 'image_optim/option_helpers'

class ImageOptim
  class Worker
    # http://advancemame.sourceforge.net/doc-advpng.html
    class Advpng < Worker
      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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
image_optim-0.17.1 lib/image_optim/worker/advpng.rb
image_optim-0.17.0 lib/image_optim/worker/advpng.rb
image_optim-0.16.0 lib/image_optim/worker/advpng.rb
image_optim-0.15.0 lib/image_optim/worker/advpng.rb
image_optim-0.14.0 lib/image_optim/worker/advpng.rb