This guide shows you how to turn a plain list of URLs into a visual HTML gallery of screenshots. You’ll learn a reliable method using free, cross-platform tools, with clear steps for capturing, naming, and assembling the images into a single viewable page. No coding experience is required, though basic familiarity with your computer’s file system helps.
What You’ll Need
- A text file containing the URLs you want to screenshot, one per line.
- A web browser (Chrome, Firefox, Edge, or Safari).
- A screenshot tool that can capture full-page or viewport images from a list. Free options include Chrome’s headless mode (command line) or browser extensions like GoFullPage (manual). For this guide, we’ll use the command-line method because it’s scriptable and handles many URLs efficiently.
- A text editor (Notepad, VS Code, or any plain text editor) to create the HTML file.
Step-by-Step
- Prepare your URL list
Create a plain text file (e.g.,urls.txt) with one URL per line. Ensure each URL starts withhttp://orhttps://. For example:https://example.comhttps://example.org/page1 - Install a screenshot tool
If you don’t have one, install Google Chrome (or use an existing Chrome-based browser). Chrome’s headless mode can capture screenshots without opening a visible window. On Windows, you’ll use Command Prompt; on macOS/Linux, Terminal. - Create a folder for screenshots
Make a new folder on your desktop, e.g.,screenshots, to keep all images organized. You’ll save your screenshots here. - Run the screenshot command (Windows)
Open Command Prompt, navigate to the folder containingurls.txt, and run a loop command. For Chrome, the syntax is:for /f %i in (urls.txt) do chrome --headless --disable-gpu --screenshot="C:\path\to\screenshots\%i.png" --window-size=1280,800 "%i"
ReplaceC:\path\to\screenshots\with your actual folder path. This captures each URL’s viewport at 1280×800 pixels. - Run the screenshot command (macOS/Linux)
In Terminal, use:while read url; do chrome --headless --disable-gpu --screenshot="$HOME/screenshots/$url.png" --window-size=1280,800 "$url"; done < urls.txt
Adjust the output path as needed. This will create PNG files named after the URLs (e.g.,example.com.png). - Check the screenshots
After the command finishes, open thescreenshotsfolder to verify that all images were created. If any failed, check the URL for typos or network issues. - Rename files for cleaner gallery names (optional)
If you want simpler names, rename the images manually or use a bulk rename tool. For example,example.com.pngcould becomesite1.png. - Create the HTML gallery
Open your text editor and create a new file calledgallery.html. Start with a basic HTML skeleton:<!DOCTYPE html>
<html>
<head><title>My Gallery</title></head>
<body>
<h1>My Screenshot Gallery</h1>
<div class="gallery">
</div>
</body>
</html> - Add image tags
For each screenshot, add an<img>tag inside the gallery div. Use the relative path to your image. Example:<img src="screenshots/example.com.png" alt="Example">
If you have many images, you can generate these lines automatically with a script or by copying and pasting. - Add basic styling (optional)
To make the gallery look neat, add a few CSS rules inside a<style>tag in the head. For example:.gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.gallery img { width: 300px; height: auto; border: 1px solid #ccc; } - Save and open the gallery
Savegallery.htmlin the same parent folder as yourscreenshotsfolder. Double-click the file to open it in your browser. You should see all your screenshots displayed in a grid.
Common Mistakes
- Missing protocol: URLs without
http://orhttps://will fail. Always include it. - Incorrect file paths: If the screenshot command can’t find your
urls.txtor can’t write to the output folder, you’ll get errors. Use absolute paths to avoid confusion. - Special characters in URLs: Characters like
&or?can break the command. Enclose the URL in quotes in the text file, or use URL-encoded versions. - Overwriting files: If two URLs produce the same filename (e.g.,
example.comandwww.example.com), one screenshot will overwrite the other. Add a counter or use the full URL as the filename. - Forgetting to close the HTML tags: A missing
</div>or</body>can break the layout. Always validate your HTML.
Tips
- Use full-page screenshots: To capture the entire page, add
--screenshotwith the--full-pageflag in Chrome headless. For example:--headless --screenshot=out.png --full-page. - Automate with a script: If you have many URLs, write a small Python or Bash script to loop through the list and generate the HTML automatically. This saves time and reduces errors.
- Compress images: Large PNGs can slow down your gallery. Use a tool like TinyPNG to reduce file size without losing quality.
- Add links: Wrap each image in an
<a>tag to make the gallery clickable. For example:<a href="https://example.com"><img src="example.com.png"></a>. - Use a consistent viewport size: For a uniform look, set the same
--window-sizefor all screenshots.
Troubleshooting
- Chrome not recognized: If the command says
chrome is not recognized, use the full path to the Chrome executable. On Windows, it’s usuallyC:\Program Files\Google\Chrome\Application\chrome.exe. On macOS, it’s/Applications/Google Chrome.app/Contents/MacOS/Google Chrome. - Blank screenshots: Some sites block headless browsers. Try using a regular browser extension like GoFullPage for those specific URLs, or use a different user-agent flag in Chrome headless:
--user-agent="Mozilla/5.0". - Timeout errors: Slow-loading pages may cause the screenshot to fail. Increase the timeout by adding
--timeout=10000(milliseconds) to the command. - Images not showing in gallery: Check that the
srcpaths in your HTML are correct relative to the HTML file. If your HTML is in the parent folder, the path should bescreenshots/filename.png. Also ensure the images actually exist. - Command line issues on Windows: If you’re using PowerShell, the
for /fsyntax differs. UseGet-Content urls.txt | ForEach-Object { chrome --headless --screenshot="...$_" "$_" }instead.
Frequently Asked Questions
Can I do this without using the command line?
Yes, you can use browser extensions like GoFullPage (Chrome) or Fireshot (Firefox) to capture screenshots manually, but you’ll have to do them one by one. For a list of many URLs, the command-line method is more efficient.
What if I want full-page screenshots instead of just the viewport?
Add the --full-page flag to your Chrome headless command. For example: chrome --headless --screenshot=out.png --full-page https://example.com. This captures the entire scrollable page.
Can I use a different browser for headless screenshots?
Yes, Firefox and Edge also support headless modes. For Firefox, use firefox --headless --screenshot out.png https://example.com. Edge is Chromium-based, so it works similarly to Chrome.
How do I handle URLs with special characters like & or ?
In your urls.txt file, enclose each URL in double quotes, e.g., "https://example.com/?a=1&b=2". In the command, the loop will read the line including quotes, which should work. Alternatively, URL-encode the special characters.
Can I generate the HTML gallery automatically?
Yes, you can write a small script (e.g., in Python) that reads your URL list, takes screenshots, and outputs an HTML file with the correct image tags. This is the most scalable approach for large lists.
My screenshots are too large. How can I reduce file size?
Use a lower resolution by adjusting --window-size (e.g., 800x600), or convert PNGs to JPEG using a tool like ImageMagick. You can also use an online compressor after capturing.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Backspace Not Working in Windows 10? Fix It
- Fix Windows Server Error 0x80070422
- Limit AI Features & Data Sharing in Apps
- How to Choose a Partition Scheme for Linux
- Error 0x80070005: Fix Access Denied in Windows
- Python Inheritance and Composition: A How-To Guide