Class: Rubycam::CLI::Commands::Snapshot
- Inherits:
-
VideoCommand
- Object
- Dry::CLI::Command
- VideoCommand
- Rubycam::CLI::Commands::Snapshot
- Defined in:
- lib/rubycam/cli.rb
Instance Method Summary collapse
Instance Method Details
#call(path: 'snapshot.jpg', **options) ⇒ Object
152 153 154 155 156 157 158 159 |
# File 'lib/rubycam/cli.rb', line 152 def call(path: 'snapshot.jpg', **) with_device() do |dev| dev.set_format(width: .fetch(:width).to_i, height: .fetch(:height).to_i, pixel_format: 'MJPG') File.binwrite(path, dev.capture_frame) puts "#{dev.card}: wrote #{path} (#{dev.width}x#{dev.height} #{dev.pixel_format})" end end |