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
15 16 17 18 19 |
# File 'lib/snapshot/screenshot_flatten.rb', line 15 def flatten(path) Dir.glob([path, '**/*.png'].join('/')).each do |file| `convert -flatten '#{file}' -alpha off -alpha remove '#{file}'` end end |
#image_magick_installed? ⇒ Boolean
21 22 23 |
# File 'lib/snapshot/screenshot_flatten.rb', line 21 def image_magick_installed? `which convert`.length > 1 end |
#run(path) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/snapshot/screenshot_flatten.rb', line 5 def run(path) 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 |