Class: Snapshot::ScreenshotFlatten

Inherits:
Object
  • Object
show all
Defined in:
lib/snapshot/screenshot_flatten.rb

Overview

This class takes care of removing the alpha channel of the generated screenshots

Instance Method Summary collapse

Instance Method Details

#flatten(path) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/snapshot/screenshot_flatten.rb', line 10

def flatten(path)
  Dir.glob([path, '/**/*.png'].join('/')).each do |file|
    UI.verbose("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
end

#run(path) ⇒ Object

Parameters:

  • The (String)

    path in which the screenshots are located in



5
6
7
8
# File 'lib/snapshot/screenshot_flatten.rb', line 5

def run(path)
  UI.message "Removing the alpha channel from generated png files"
  flatten(path)
end