Crates.io | imagesnap |
lib.rs | imagesnap |
version | 0.0.1 |
source | src |
created_at | 2021-05-13 02:59:35.585221 |
updated_at | 2021-05-13 02:59:35.585221 |
description | A CLI for capturing images 📷 📸 🖼️ |
homepage | |
repository | https://github.com/smudge/imagesnap |
max_upload_size | |
id | 396774 |
size | 35,311 |
A CLI for capturing images on macOS 📷 📸 🖼️
This crate also doubles as a Rust library. 🦀
brew install smudge/smudge/imagesnap
Set up Rust/Cargo and install from crates.io by running:
cargo install imagesnap
Run the command without any arguments to output snapshot.jpg
, captured from the default camera:
$ imagesnap
Capturing image from device "iSight"..................snapshot.jpg
The filename can be changed by specifying an argument. Only JPG files are currently supported:
$ imagesnap shot1.jpg
Capturing image from device "iSight"..................shot1.jpg
Use the -l
flag to list all available image capture devices:
$ imagesnap -l
iSight
DV
Use the -d
flag to use a specific device:
$ imagesnap -d DV
Capturing image from device "DV"..................snapshot.jpg
Use the -w
flag to specify a warmup period (default is 0.5), allowing the camera to perform light balancing and/or focus before taking a shot:
$ imagesnap -w 2.5
Capturing image from device "iSight"...........................snapshot.jpg
Use the -q
flag to silence the status and progress output.
Lastly, run the command with -h
/--help
to see usage instructions.
In addition to a CLI, imagesnap
can be pulled-in as a dependency for other Rust crates:
imagesnap = "0.0.1"
To snap an image with the default camera, use Camera::default
:
let camera = Camera::default();
camera.snap("snapshot.jpg").await;
Note that snap
is an async
function.
If more than one camera is attached, use Camera::new
and specify a device:
let camera = Camera::new(Device::find("FaceTime"), None);
To discover all devices, use Device::all()
.
An optional warmup period may also be specificied (in seconds):
let camera = Camera::new(Device::default(), 1.5);
If left unspecified, it will default to 0.5 seconds.
rscam
)escapi
)cargo build
) and functionality still works as expected.Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.