rharder/imagesnap
소개
명령줄에서 이미지 캡처
디자인 및 미디어측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalImageSnap
by: Robert Harder (original), Swift port
Capture Images from the Command Line
ImageSnap is a command-line tool that lets you capture still images from an iSight or other video source. This is a Swift rewrite of the original Objective-C version, using modern AVFoundation APIs.
Installation
Building from Source
Using Xcode:
- Open
ImageSnap.xcodeprojin Xcode - Select Product > Build (⌘B)
- The built
imagesnapexecutable will be in the DerivedData folder
Using Command Line:
cd ImageSnap
xcodebuild -scheme imagesnap -configuration Release build
Or compile directly with swiftc:
swiftc -o imagesnap main.swift -framework AVFoundation -framework AppKit -framework CoreImage
Installing
Copy the imagesnap binary to someplace on your path like /usr/local/bin:
cp imagesnap /usr/local/bin/
The first time you use the tool, you may get a popup window from macOS asking to give imagesnap permission to access the camera.
Usage
To capture an image simply run the program from the command line. There is a delay of a few seconds while the camera warms up, and then...snap!
$ imagesnap
Capturing image from device "FaceTime HD Camera"..................snapshot.jpg
To specify a filename, make that your last argument:
$ imagesnap icu.jpg
Capturing image from device "FaceTime HD Camera"..................icu.jpg
If you have multiple video devices attached to your computer, use the -l ("el") flag to list them:
$ imagesnap -l
Video Devices:
=> FaceTime HD Camera
=> Logitech BRIO
=> USB 2.0 Camera
To select a specific video device use the -d flag with the full or partial name of a device:
$ imagesnap -d BRIO
Capturing image from device "Logitech BRIO"..................snapshot.jpg
You can capture a series of images in a timelapse using the -t option. The following command would take a picture every 60 seconds:
$ imagesnap -d BRIO -t 60
Capturing image from device "Logitech BRIO"..................snapshot-00001.jpg
snapshot-00002.jpg
snapshot-00003.jpg
Use -n to limit the number of timelapse captures:
$ imagesnap -t 10 -n 5
Capturing image from device "FaceTime HD Camera"..................snapshot-00001.jpg
snapshot-00002.jpg
snapshot-00003.jpg
snapshot-00004.jpg
snapshot-00005.jpg
There is a default warmup period of three seconds when you take a picture. This gives the camera time to get its sensors all set up. Your camera might have a faster or slower response time, so you can adjust the warmup period to suit your needs:
$ imagesnap -w 0
Capturing image from device "FaceTime HD Camera"...snapshot.jpg
Command Line Options
USAGE: imagesnap [options] [filename]
Version: 0.3.1
Captures an image from a video device and saves it in a file.
If no device is specified, the system default will be used.
If no filename is specified, snapshot.jpg will be used.
Supported image types: JPEG, TIFF, PNG, GIF, BMP
-h This help message
-v Verbose mode
-l List available video devices
-t x.xx Take a picture every x.xx seconds
-n x Limit the number of timelapse pictures to x
-q Quiet mode. Do not output any text
-w x.xx Warmup. Delay snapshot x.xx seconds after turning on camera
-d device Use named video device
Image Formats
The following image formats are supported and are determined by the filename extension:
- JPEG (.jpg, .jpeg) - default
- PNG (.png)
- TIFF (.tiff, .tif)
- GIF (.gif)
- BMP (.bmp)
Changes
- v0.3.1 - Bug fixes: saving over an existing file no longer fails,
~/...paths now expand to the home directory instead of creating a literal~folder, timelapse sequence detection works with filenames containing regex special characters (e.g. parentheses), relative paths work when the working directory lives under /tmp or /var, and Ctrl-C during a timelapse exits cleanly. - v0.3.0 - Complete rewrite in Swift using AVFoundation. Supports macOS 13+.
Requirements
- macOS 13.0 (Ventura) or later
- Xcode 15.0 or later (for building)
- A connected camera (built-in or external)
Old Versions
If you want the old Objective-C version of this tool, you can grab that from the releases section or use git to grab the old repo.
You can grab it like so:
git checkout v0.2.16
I did a complete rewrite in Swift, but that brings the compatibility down, or up depending on how you count, to only work on later versions of MacOS. The previous Objective-C version goes way back, and XCode complains about old frameworks.
I'm kind of leaning toward going back to the Objective-C version so that people with older MacBooks and what not can still use this tool. If this is causing you problems, please let me know.
License
Public Domain - This software is released into the Public Domain. You can do whatever you want with it.
관련 프로젝트 살펴보기
불러오는 중…