Sign inSign up

screenshotone/cli

By screenshotone

•Updated 27 days ago

A CLI access to the ScreenshotOne API wrapped as a Docker image.

Image
Developer tools
0

582

screenshotone/cli repository overview

⁠ScreenshotOne CLI

A command line interface to integrate ScreenshotOne (the screenshot API for developers)⁠ into your workflows.

ScreenshotOne is one of the best screenshot APIs⁠, it supports:

Check the ScreenshotOne documentation⁠ for more details.

⁠Installation

bun install
⁠Using Docker
docker build -t screenshotone/cli .

⁠Configuration

Sign up⁠ to get your access key and secret key.

⁠Environment Variables
export SCREENSHOTONE_ACCESS_KEY="your-access-key"
export SCREENSHOTONE_SECRET_KEY="your-secret-key"
⁠Configuration File

Create ~/.screenshotone/config.json:

{
    "access_key": "your-access-key",
    "secret_key": "your-secret-key"
}
⁠CLI Flags
screenshotone take https://example.com --access-key=xxx --secret-key=yyy

If you are using Docker:

docker run -e SCREENSHOTONE_ACCESS_KEY=xxx -e SCREENSHOTONE_SECRET_KEY=yyy \
  screenshotone/cli take https://example.com

⁠Commands

⁠Core Commands
⁠take - Take a screenshot
screenshotone take <url|html|markdown> [options]

# Examples
screenshotone take https://example.com -o screenshot.png
screenshotone take https://example.com --format=jpg --image-quality=90 -o photo.jpg
screenshotone take "<h1>Hello</h1>" --html -o hello.png
screenshotone take "# Hello World" --markdown -o hello.png
⁠animate - Create animated video/gif
screenshotone animate <url> [options]

# Examples
screenshotone animate https://example.com --duration=5 -o video.mp4
screenshotone animate https://example.com --format=gif --duration=3 -o animation.gif
⁠usage - Check API usage
screenshotone usage
screenshotone usage --json
⁠Shortcut Commands
⁠screenshot - Take a PNG screenshot (default)
screenshotone screenshot https://example.com -o shot.png
⁠pdf - Generate PDF
screenshotone pdf https://example.com -o document.pdf
screenshotone pdf https://example.com --pdf-print-background -o styled.pdf
⁠full-page - Full page screenshot
screenshotone full-page https://example.com -o full.png
screenshotone full-page https://example.com --full-page-scroll -o scrolled.png
⁠scrolling - Scrolling video
screenshotone scrolling https://example.com --duration=5 -o scroll.mp4
screenshotone scrolling https://example.com --scroll-duration=3000 --format=gif -o scroll.gif
⁠video - Record video
screenshotone video https://example.com --duration=10 -o recording.mp4
⁠html - Render HTML
screenshotone html "<h1>Hello World</h1><p>This is a test</p>" -o hello.png
⁠markdown - Render Markdown
screenshotone markdown "# Hello World" -o hello.png

⁠Output Options

OptionDescription
-o, --output <file>Save to file
--stdoutOutput binary to stdout (for piping)
--jsonOutput signed URL as JSON
⁠Examples
# Save to file
screenshotone take https://example.com -o screenshot.png

# Pipe to another command
screenshotone take https://example.com --stdout | imgcat

# Get signed URL as JSON
screenshotone take https://example.com --json
# Output: {"url": "https://api.screenshotone.com/take?..."}

⁠All Options

⁠Viewport
OptionDescription
--viewport-widthWidth in pixels
--viewport-heightHeight in pixels
--viewport-deviceDevice to emulate
--viewport-mobileMobile viewport
--viewport-has-touchTouch support
--viewport-landscapeLandscape orientation
--device-scale-factorScale factor (1, 2, or 3)
⁠Format & Quality
OptionDescription
--formatpng, jpg, webp, gif, pdf, html
--image-qualityQuality 1-100 (jpg, webp)
--image-widthResize width
--image-heightResize height
--omit-backgroundTransparent background
⁠Full Page
OptionDescription
--full-pageCapture full page
--full-page-scrollScroll before capture
--full-page-scroll-delayDelay between scrolls
--full-page-max-heightMaximum height
--full-page-algorithmAlgorithm to use
--capture-beyond-viewportCapture beyond viewport
⁠PDF Options
OptionDescription
--pdf-print-backgroundInclude background
--pdf-fit-one-pageFit to one page
⁠Blocking
OptionDescription
--block-adsBlock advertisements
--block-cookie-bannersBlock cookie banners
--block-chatsBlock chat widgets
--block-trackersBlock trackers
--block-banners-by-heuristicsBlock banners
--block-requestsBlock URLs (array)
--block-resourcesBlock resource types
⁠Selectors
OptionDescription
--selectorElement to capture
--hide-selectorsElements to hide
--wait-for-selectorWait for element
--scroll-into-viewScroll element into view
--error-on-selector-not-foundError if not found
⁠Timing
OptionDescription
--delayDelay before capture (ms)
--timeoutRequest timeout (ms)
--navigation-timeoutNavigation timeout (ms)
--wait-untilWait for events
⁠Caching
OptionDescription
--cacheEnable caching
--cache-ttlCache TTL in seconds
--cache-keyCustom cache key
⁠Storage (S3)
OptionDescription
--storeStore to S3
--storage-pathStorage path
--storage-bucketBucket name
--storage-access-key-idAWS access key
--storage-secret-access-keyAWS secret key
--storage-endpointCustom endpoint
--storage-classStorage class
--storage-aclACL
--storage-return-locationReturn location
⁠Request
OptionDescription
--user-agentCustom user agent
--authorizationAuthorization header
--proxyProxy URL
--cookiesCookies (array)
--headersHeaders (array)
--time-zoneTime zone
--ip-country-codeIP country code
--bypass-cspBypass CSP
⁠Geolocation
OptionDescription
--geolocation-latitudeLatitude
--geolocation-longitudeLongitude
--geolocation-accuracyAccuracy in meters
⁠Rendering
OptionDescription
--dark-modeDark mode
--reduced-motionReduced motion
--media-typescreen or print
--stylesCustom CSS
--scriptsCustom JavaScript
--request-gpu-renderingGPU rendering
--ignore-host-errorsIgnore host errors
⁠Clipping
OptionDescription
--clip-xX coordinate
--clip-yY coordinate
--clip-widthWidth
--clip-heightHeight
⁠Metadata
OptionDescription
--metadata-image-sizeInclude image size
--metadata-fontsInclude fonts
--metadata-open-graphInclude Open Graph
--metadata-page-titleInclude page title
--metadata-contentInclude content
--metadata-http-response-status-codeInclude status
--metadata-http-response-headersInclude headers
⁠Async & Webhooks
OptionDescription
--asyncAsync execution
--webhook-urlWebhook URL
--webhook-signSign webhook
⁠Failure
OptionDescription
--fail-if-content-containsFail on content
--fail-if-gpu-rendering-failsFail on GPU error
⁠Vision (OpenAI)
OptionDescription
--openai-api-keyOpenAI API key
--vision-promptVision prompt
--vision-max-tokensMax tokens
⁠Animation Options
OptionDescription
--durationDuration in seconds
--scenarioAnimation scenario
--widthVideo width
--heightVideo height
--aspect-ratioAspect ratio
⁠Scrolling Animation
OptionDescription
--scroll-delayScroll delay
--scroll-durationScroll duration
--scroll-start-delayStart delay
--scroll-start-immediatelyStart immediately
--scroll-backScroll back
--scroll-back-after-durationScroll back after
--scroll-back-algorithmScroll back algorithm
--scroll-completeComplete scroll
--scroll-byScroll by pixels
--scroll-easingEasing function
--scroll-stop-after-durationStop after duration
--scroll-try-navigateNavigate on scroll
--scroll-navigate-afterNavigate after
--scroll-navigate-to-urlNavigate URL
--scroll-navigate-link-hintsLink hints

⁠Docker Usage

# Build the image
docker build -t screenshotone-cli .

# Run with environment variables
docker run -e SCREENSHOTONE_ACCESS_KEY=xxx -e SCREENSHOTONE_SECRET_KEY=yyy \
  screenshotone-cli take https://example.com --stdout > screenshot.png

# Run with mounted volume for output
docker run -v $(pwd)/output:/output \
  -e SCREENSHOTONE_ACCESS_KEY=xxx -e SCREENSHOTONE_SECRET_KEY=yyy \
  screenshotone-cli take https://example.com -o /output/screenshot.png

⁠Development

# Install dependencies
bun install

# Run
bun run index.ts take https://example.com

# Build binary
bun build index.ts --compile --outfile screenshotone

⁠License

ScreenshotOne CLI is licensed under the MIT License⁠.

Tag summary

Content type

Image

Digest

sha256:ea32e43d4…

Size

93.1 MB

Last updated

27 days ago

docker pull screenshotone/cli