Class: Snapshot::ScreenshotFlatten
- Inherits:
-
Object
- Object
- Snapshot::ScreenshotFlatten
- 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
16 17 18 19 20 21 22 |
# File 'lib/snapshot/screenshot_flatten.rb', line 16 def flatten(path) Dir.glob([path, '/**/*.png'].join('/')).each do |file| Helper.log.info "Removing alpha channel from '#{file}'" `convert -flatten '#{file}' -alpha off -alpha remove '#{file}'` end Helper.log.info "Finished removing the alpha channel." end |
#image_magick_installed? ⇒ Boolean
24 25 26 |
# File 'lib/snapshot/screenshot_flatten.rb', line 24 def image_magick_installed? `which convert`.length > 1 end |
#run(path) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/snapshot/screenshot_flatten.rb', line 5 def run(path) Helper.log.info "Going to remove the alpha channel from generated png files" if image_magick_installed? flatten(path) else Helper.log.info "Could not remove transparency of generated screenhots.".yellow Helper.log.info "This will cause problems when trying to manually upload them to iTC.".yellow Helper.log.info "You can install 'imagemagick' using 'brew install imagemagick' to enable this feature.".yellow end end |