Class: Snapshot::ScreenshotFlatten

Inherits:
Object
  • Object
show all
Defined in:
snapshot/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



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

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



7
8
9
10
# File 'snapshot/lib/snapshot/screenshot_flatten.rb', line 7

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