Examples

Practical recipes for common CLI workflows.

Social Cards

Generate OG Images for a Blog

# Single post
rs take https://myblog.com/my-first-post --preset og_card -o og-image.png

# All posts from a URL list
rs batch -f blog-urls.txt --preset og_card -d ./og-images/

Twitter Cards

rs take https://myblog.com/my-first-post --preset twitter_card -o twitter-card.png

Screenshots for Documentation

Capture UI States

# Desktop view
rs take https://app.example.com/dashboard -o docs/dashboard-desktop.png

# Mobile view
rs take https://app.example.com/dashboard --device iphone_14_pro -o docs/dashboard-mobile.png

# Dark mode
rs take https://app.example.com/dashboard --dark-mode -o docs/dashboard-dark.png

Full Page Captures

rs take https://example.com/pricing --full-page --block-ads --block-cookies -o pricing-full.png

PDF Generation

Convert a Report to PDF

rs take https://app.example.com/report/q4 \
  --format pdf \
  --pdf-paper a4 \
  --pdf-margin 2cm \
  --pdf-background \
  -o q4-report.pdf

Invoice PDF with Headers and Footers

rs take https://app.example.com/invoice/123 \
  --format pdf \
  --pdf-paper letter \
  --pdf-margin 1in \
  --pdf-header '<div style="font-size:10px;text-align:center;">INVOICE</div>' \
  --pdf-footer '<div style="font-size:10px;text-align:center;">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>' \
  -o invoice-123.pdf

Fit Content to a Single Page

rs take https://app.example.com/summary \
  --format pdf \
  --pdf-paper a4 \
  --pdf-fit-one-page \
  -o summary.pdf

Extract Specific Pages

rs take https://app.example.com/report \
  --format pdf \
  --pdf-page-ranges '1-3, 5' \
  -o excerpt.pdf

Check OG Tags Before Sharing

# Quick check of a single page
rs preview https://myblog.com/new-post

# JSON output for scripting
rs preview https://myblog.com/new-post --json | jq '.og.image'

Audit Meta Tags Across Your Site

#!/bin/bash
# Check that every page has OG tags
while read -r url; do
  result=$(rs preview "$url" --json 2>/dev/null)
  title=$(echo "$result" | jq -r '.og.title // "MISSING"')
  image=$(echo "$result" | jq -r '.og.image // "MISSING"')
  echo "$url | og:title=$title | og:image=$image"
done < site-urls.txt

Compare Your OG Tags with Competitors

for site in https://myapp.com https://competitor1.com https://competitor2.com; do
  echo "=== $site ==="
  rs preview "$site" --json | jq '{title: .og.title, image: .og.image, description: .og.description}'
  echo
done

Page Manipulation

Remove Distractions Before Capture

# Click cookie banner, hide chat widget, remove sidebar
rs take https://example.com \
  --click '.accept-cookies' \
  --hide '.chat-widget,.notification-bar' \
  --remove '.sidebar,.footer' \
  -o clean-page.png

Inject Custom Styles

# Increase font size for documentation screenshots
rs take https://example.com/docs \
  --inject-style 'body { font-size: 18px; } .sidebar { display: none; }' \
  --width 1200 \
  -o docs-screenshot.png

Transparent Background

# Capture a logo with transparent background
rs take https://example.com --element '.logo' --transparent -o logo.png

Clean Screenshots

Block All Distractions

# Remove ads, cookie banners, chat widgets, and block tracking
rs take https://news-site.com/article \
  --block-ads \
  --block-trackers \
  --block-cookies \
  --block-chat \
  -o clean-article.png

Block Specific URLs and Resources

# Block specific ad networks and skip loading fonts
rs take https://example.com \
  --block-urls '*google-analytics*,*.doubleclick.net,*facebook.net*' \
  --block-resources font,media \
  -o lightweight.png

Authenticated and Localized Pages

Screenshot Behind Authentication

# HTTP Basic auth (staging environments)
rs take https://staging.example.com/admin --auth-basic admin:secret123 -o admin.png

# Bearer token (API dashboards)
rs take https://app.example.com/dashboard --auth-bearer eyJhbG... -o dashboard.png

# Custom headers (feature flags, API keys for the target page)
rs take https://example.com --headers '{"X-Feature-Flag":"redesign","Accept-Language":"en-US"}' -o feature.png

# Set cookies (logged-in state)
rs take https://example.com/account \
  --cookies '[{"name":"session","value":"abc123","domain":".example.com"}]' \
  -o account.png

Localized Screenshots

# French locale with Paris timezone
rs take https://example.com --locale fr-FR --timezone Europe/Paris -o french.png

# Japanese locale with Tokyo timezone
rs take https://example.com --locale ja-JP --timezone Asia/Tokyo -o japanese.png

# Spoof geolocation for location-dependent content
rs take https://maps.example.com \
  --geolocation 40.7128,-74.006 \
  --timezone America/New_York \
  -o nyc.png

Content Validation

Verify Pages After Deployment

# Fail if the page shows an error
rs take https://app.example.com/dashboard \
  --fail-if-contains 'Error,500,Access Denied' \
  --fail-if-missing 'Welcome,Dashboard' \
  -o dashboard.png

# Use in CI to catch broken pages
rs take https://staging.example.com --fail-on-error -o staging.png || exit 1

CI/CD Integration

Visual Regression in GitHub Actions

name: Visual Regression
on: [pull_request]

jobs:
  screenshots:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install CLI
        run: |
          curl -L https://github.com/Render-Screenshot/rs-cli/releases/latest/download/rs-linux-amd64 -o rs
          chmod +x rs
          sudo mv rs /usr/local/bin/

      - name: Capture screenshots
        env:
          RS_API_KEY: ${{ secrets.RS_API_KEY }}
        run: |
          rs take https://staging.myapp.com/ --preset desktop_hd -o screenshots/home.png
          rs take https://staging.myapp.com/pricing --preset desktop_hd -o screenshots/pricing.png
          rs take https://staging.myapp.com/ --device iphone_14_pro -o screenshots/home-mobile.png

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: screenshots
          path: screenshots/

Generate Social Cards on Deploy

- name: Generate OG images
  env:
    RS_API_KEY: ${{ secrets.RS_API_KEY }}
  run: rs batch -f public/blog-urls.txt --preset og_card -d public/og-images/

Shell Scripting

Screenshot Multiple Pages with a Loop

#!/bin/bash
for page in home about pricing docs; do
  rs take "https://example.com/$page" \
    --preset desktop_hd \
    --block-ads \
    -o "screenshots/$page.png"
  echo "Captured: $page"
done

Generate Signed URLs for Embedding

#!/bin/bash
# Generate signed OG image URLs for all blog posts
while read -r url; do
  signed=$(rs signed-url "$url" --preset og_card --expires 30d)
  echo "$url -> $signed"
done < blog-urls.txt

Pipe to Other Tools

# Send screenshot to S3
rs take https://example.com --stdout | aws s3 cp - s3://my-bucket/screenshot.png

# Pipe to ImageMagick for processing
rs take https://example.com --stdout | convert - -resize 50% thumbnail.png

# Upload to Slack
rs take https://example.com -o /tmp/screenshot.png && \
  curl -F file=@/tmp/screenshot.png -F channels=general \
    -H "Authorization: Bearer xoxb-..." https://slack.com/api/files.upload

Check Cache Before Rendering

# Only return a screenshot if it's already cached (no new render)
rs take https://example.com --cache-available -o cached.png

# Useful in scripts to avoid spending credits
rs take https://example.com --cache-available --json | jq '.cache.hit'

Monitor Page Changes

#!/bin/bash
# Take a screenshot every hour and compare
while true; do
  timestamp=$(date +%Y%m%d-%H%M%S)
  rs take https://competitor.com/pricing \
    --cache-refresh \
    -o "monitoring/$timestamp.png" \
    --quiet
  sleep 3600
done

Batch Processing with JSON Manifest

For complex batches with different options per URL, use a JSON manifest:

{
  "requests": [
    {
      "url": "https://example.com",
      "preset": "og_card"
    },
    {
      "url": "https://example.com/about",
      "width": 1920,
      "height": 1080,
      "dark_mode": true
    },
    {
      "url": "https://example.com/docs",
      "full_page": true,
      "block_ads": true,
      "block_cookies": true
    }
  ]
}
rs batch --manifest batch.json -d ./output/

HTML and Markdown Input

Screenshot HTML Content

# From a string
rs take --html '<h1 style="font-size:72px;text-align:center;padding:100px;">Hello World</h1>' \
  --width 1200 --height 630 -o hello.png

# From a file
rs take --html "$(cat template.html)" --width 1200 --height 630 -o card.png

Dynamic Social Cards from Templates

#!/bin/bash
TITLE="My Blog Post Title"
HTML="<div style='display:flex;align-items:center;justify-content:center;width:1200px;height:630px;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:white;font-family:system-ui;font-size:48px;padding:60px;text-align:center;'>$TITLE</div>"

rs take --html "$HTML" --width 1200 --height 630 -o og-image.png

Was this page helpful?