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 (prints one image URL per post)
rs batch --file blog-urls.txt --preset og_card

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 '.open_graph.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 '.open_graph.title // "MISSING"')
  image=$(echo "$result" | jq -r '.open_graph.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: .open_graph.title, image: .open_graph.image, description: .open_graph.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

Capture One Element

# Capture only the logo element
rs take https://example.com --element '.logo' -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

The CLI has no content-check flags. To fail a capture when a page shows an error, call the API with options.fail_if_contains and options.fail_if_missing (see the content checks guide). In a script, rs take exits non-zero when the API returns an error, so || exit 1 stops a CI job:

rs take https://staging.example.com -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: |
          base=https://github.com/Render-Screenshot/rs-cli/releases/latest/download
          curl -fsSLO "$base/rs_linux_amd64.tar.gz"
          curl -fsSLO "$base/checksums.txt"
          grep ' rs_linux_amd64.tar.gz$' checksums.txt | sha256sum -c -
          tar -xzf rs_linux_amd64.tar.gz rs
          sudo mv rs /usr/local/bin/
          mkdir -p screenshots

      - 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 --file public/blog-urls.txt --preset og_card --json > og-images.json

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

Keep a Result Cached Longer

# Cache the result for 7 days and print its cache key
rs take https://example.com --cache-ttl 604800 --json | jq -r '.cache.key'

# Later: fetch the stored image by key (no new render)
rs cache get cache_xyz789 -o cached.png

To reuse a cached render of the same options for 0 credits, add --cache-available:

rs take https://example.com --cache-available -o example.png

Without it, rs take always renders fresh. See caching.

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:

[
  {
    "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_cookie_banners": true
  }
]
rs batch --manifest batch.json

The commands reference lists every manifest key the CLI reads.

HTML 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?