URL Screenshot Capture

Convert any webpage into a screenshot by simply entering its URL below. Perfect for archiving, sharing, or documentation purposes.

https://

Screenshot Result

Your screenshot will appear here after capture

python_script.py
import sys
import pyautogui
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

def take_screenshot(url, filename="screenshot.png", full_page=False):
    try:
        # Set up Chrome options
        options = Options()
        options.add_argument("--headless")  # Run in headless mode
        options.add_argument("--disable-gpu")
        options.add_argument("--window-size=1920,1080")
        
        # Initialize the driver
        driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
        
        # Navigate to the URL
        driver.get(url)
        
        # Take screenshot
        if full_page:
            # Capture full page (requires scrolling)
            total_height = driver.execute_script("return document.body.scrollHeight")
            driver.set_window_size(1920, total_height)
            driver.save_screenshot(filename)
        else:
            # Capture viewport only
            pyautogui.screenshot(filename)
        
        print(f"Screenshot saved as {filename}")
        return True
    except Exception as e:
        print(f"Error: {str(e)}")
        return False
    finally:
        driver.quit()

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print("Usage: python screenshot.py  [output_filename] [--full-page]")
        sys.exit(1)
    
    url = sys.argv[1]
    filename = sys.argv[2] if len(sys.argv) > 2 else "screenshot.png"
    full_page = "--full-page" in sys.argv
    
    success = take_screenshot(url, filename, full_page)
    sys.exit(0 if success else 1)
                

This Python script requires selenium, pyautogui, and webdriver-manager.

Install them with: pip install selenium pyautogui webdriver-manager

Made with DeepSite LogoDeepSite - 🧬 Remix