class Snapshot::ScreenshotFlatten

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

Public Instance Methods

flatten(path) click to toggle source
# 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) click to toggle source

@param (String) The path in which the screenshots are located in

# 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