Sha256: a85f4495d1a599dabf692171c8ccd548eac3a8579d1952559a013c0a786f0fd3

Contents?: true

Size: 762 Bytes

Versions: 15

Compression:

Stored size: 762 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 run_order
        4
      end

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

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
image_optim-0.26.3 lib/image_optim/worker/advpng.rb
image_optim-0.26.2 lib/image_optim/worker/advpng.rb
discourse_image_optim-0.26.2 lib/image_optim/worker/advpng.rb
image_optim-0.26.1 lib/image_optim/worker/advpng.rb
image_optim-0.26.0 lib/image_optim/worker/advpng.rb
image_optim-0.25.0 lib/image_optim/worker/advpng.rb
image_optim-0.24.3 lib/image_optim/worker/advpng.rb
image_optim-0.24.2 lib/image_optim/worker/advpng.rb
image_optim-0.24.1 lib/image_optim/worker/advpng.rb
image_optim-0.24.0 lib/image_optim/worker/advpng.rb
image_optim-0.23.0 lib/image_optim/worker/advpng.rb
image_optim-0.22.1 lib/image_optim/worker/advpng.rb
image_optim-0.22.0 lib/image_optim/worker/advpng.rb
openstreetmap-image_optim-0.21.0.1 lib/image_optim/worker/advpng.rb
image_optim-0.21.0 lib/image_optim/worker/advpng.rb