Sha256: 04565e44c0160bf40d9d39c74594d9da7be5a5d2affac1a13df0626a5582ec8d

Contents?: true

Size: 664 Bytes

Versions: 4

Compression:

Stored size: 664 Bytes

Contents

module Snapshot
  # This class takes care of removing the alpha channel of the generated screenshots
  class ScreenshotFlatten
    # @param (String) The path in which the screenshots are located in
    def run(path)
      Helper.log.info "Removing the alpha channel from generated png files"
      flatten(path)
    end

    def flatten(path)
      Dir.glob([path, '/**/*.png'].join('/')).each do |file|
        Helper.log.info "Removing alpha channel from '#{file}'" if $verbose
        `sips -s format bmp '#{file}' &> /dev/null ` # &> /dev/null because there is warning because of the extension
        `sips -s format png '#{file}'`
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
snapshot-0.10.2 lib/snapshot/screenshot_flatten.rb
snapshot-0.10.1 lib/snapshot/screenshot_flatten.rb
snapshot-0.10.0 lib/snapshot/screenshot_flatten.rb
snapshot-0.9.3 lib/snapshot/screenshot_flatten.rb