Sha256: 7d8c626f37abaf14561f5728c6d7471fd2a658c3af567af547ece1845675c4af

Contents?: true

Size: 732 Bytes

Versions: 3

Compression:

Stored size: 732 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 "Going to remove 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
      Helper.log.info "Finished removing the alpha channel."
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
snapshot-0.9.2 lib/snapshot/screenshot_flatten.rb
snapshot-0.9.1 lib/snapshot/screenshot_flatten.rb
snapshot-0.9.0 lib/snapshot/screenshot_flatten.rb