Sha256: ba27501bbb5b51b4a25739a060e41b0521b910d696672f74c865c110a96b996c

Contents?: true

Size: 720 Bytes

Versions: 12

Compression:

Stored size: 720 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}'"
        `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

12 entries across 12 versions & 1 rubygems

Version Path
snapshot-0.8.0 lib/snapshot/screenshot_flatten.rb
snapshot-0.7.1 lib/snapshot/screenshot_flatten.rb
snapshot-0.7.0 lib/snapshot/screenshot_flatten.rb
snapshot-0.6.1 lib/snapshot/screenshot_flatten.rb
snapshot-0.6.0 lib/snapshot/screenshot_flatten.rb
snapshot-0.5.0 lib/snapshot/screenshot_flatten.rb
snapshot-0.4.13 lib/snapshot/screenshot_flatten.rb
snapshot-0.4.12 lib/snapshot/screenshot_flatten.rb
snapshot-0.4.11 lib/snapshot/screenshot_flatten.rb
snapshot-0.4.10 lib/snapshot/screenshot_flatten.rb
snapshot-0.4.9 lib/snapshot/screenshot_flatten.rb
snapshot-0.4.8 lib/snapshot/screenshot_flatten.rb