Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Use Playwright to open each URL, wait for the page content you need, capture a screenshot, and save a result tied to that URL. For a reliable batch, also record navigation status and errors: HTTP 404 and 500 responses do not necessarily throw an exception, so a screenshot alone does not prove the page succeeded.

What the workflow does

A thumbnail batch is a loop around Playwright’s navigation and screenshot APIs. For every input URL, the script navigates to the page, waits for an appropriate readiness signal, captures either the visible viewport, the full document, or a specific element, and writes an image. A manifest makes each output traceable and lets you identify pages to review or retry.

The example below uses Node.js with Playwright’s Chromium browser. It reads one URL per line from urls.txt, limits concurrent pages, saves viewport screenshots as PNG, and writes a JSON Lines manifest. The worker limit is configurable rather than a universal recommendation: choose it by measuring your URLs and available memory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Playwright and prepare the URL list

  1. Install Playwright in a project: npm init -y, then npm install playwright.
  2. Install the browser binary: npx playwright install chromium.
  3. Create urls.txt with one complete URL per line. Blank lines and lines beginning with # are ignored.
  4. Save the script below as thumbnails.mjs.

Use stable names based on the list position rather than turning raw URLs into filesystem paths. This avoids invalid characters and collisions when different URLs normalize to similar names.

#1 Best Overall
Sale
Liene M100 4x6'' Photo Printer, Phone Printer 100 Sheets & 3 Cartridges, Full-Color Photo, Portable Instant Photo Printer for iPhone Android, Thermal Dye Sublimation, Wi-Fi Picture Printer 100 Papers
  • User-Friendly Portable Photo Printer for iPhone, Android & PC - Get beautiful and colourful memories with Liene 4x6 photo printer! After opening the entire package, you can find one cartridge + 20 sheets of photo paper (placed inside the machine packaging), as well as an additional box containing 80 sheets of photo paper (which includes two cartridges + 80 sheets of photo paper). Full package includes smartphone photo printer, Liene 4x6 photo printer papers (100 sheets), 3 colour cartridges, and fully sealed cassette to prevent dust. Minimalist and magnetic design for compact storage.
  • Superior Quality 4x6 Photo Printer - Print photos like no other thanks to the thermal-dye sublimation tech adopted by the picture printer for iphone. The dyes deeply penetrate the paper for vibrant photo printing, and the laminated surface is resistant to water, scratches, fingerprints and fading. Clean the print head promptly if smudges are observed on printed photos during operation. Get Liene photo printers now for yourself and your loved ones, print your happy moments together and keep your love forever!
  • Wi-Fi Photo Printer for Smartphone - The built-in hotspot of the photo printer makes it easy to print pictures from your phone, avoiding outside interference with a fast and stable connection. No other networks required! Simply connect your device to the independent instant photo printer 4x6 hotspot.
  • Multiple Device Compatibility - Liene phone printer provides instant photo printing for up to 5 simultaneous connections. Share with family and friends or print from your different devices. No additional cables or Bluetooth required when printing photos with this picture printer. Note: Ensure the ink cartridge clicks into place before printing.
  • Customize your Printing with the Liene App - Customize your photos with our specialized App! You can add a Square border, insert filters, enhance the contrast and brightness, check printing status, and more. You can even print your ID and Visa photos from home with this photo printer for iphone 4x6 prints.

Run a bounded batch and keep an auditable manifest

import { chromium } from 'playwright';
import { mkdir, readFile, writeFile } from 'node:fs/promises';
import path from 'node:path';

const inputFile = process.argv[2] ?? 'urls.txt';
const outputDir = process.argv[3] ?? 'thumbnails';
const workerCount = Math.max(1, Number(process.env.WORKERS ?? 4));

const urls = (await readFile(inputFile, 'utf8'))
  .split(/r?n/)
  .map(line => line.trim())
  .filter(line => line && !line.startsWith('#'));

await mkdir(outputDir, { recursive: true });
const manifestPath = path.join(outputDir, 'manifest.jsonl');
await writeFile(manifestPath, '');

const browser = await chromium.launch();
let next = 0;

async function worker() {
  while (true) {
    const index = next++;
    if (index >= urls.length) return;

    const url = urls[index];
    const id = String(index + 1).padStart(4, '0');
    const outputPath = path.join(outputDir, `${id}.png`);
    let record = { inputUrl: url, outputPath, finalUrl: null, status: null, result: 'failed', error: null };
    let page;

    try {
      page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
      const response = await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30000 });
      record.finalUrl = page.url();
      record.status = response?.status() ?? null;

      // Replace this with a selector that indicates the desired content is ready,
      // when the site loads that content asynchronously.
      // await page.locator('main').waitFor({ state: 'visible', timeout: 10000 });

      if (record.status !== null && record.status >= 400) {
        record.result = 'http-error';
      } else {
        await page.screenshot({ path: outputPath, type: 'png' });
        record.result = 'captured';
      }
    } catch (error) {
      record.error = error instanceof Error ? error.message : String(error);
    } finally {
      await page?.close().catch(() => {});
      await writeFile(manifestPath, `${JSON.stringify(record)}n`, { flag: 'a' });
    }
  }
}

try {
  await Promise.all(Array.from({ length: Math.min(workerCount, urls.length) }, () => worker()));
} finally {
  await browser.close();
}

Run it with node thumbnails.mjs urls.txt thumbnails. Set a lower or higher bounded worker count with, for example, WORKERS=2 node thumbnails.mjs. Each successful record points to a PNG; HTTP error pages are recorded but not captured by this policy. Change that branch if diagnostic screenshots of error pages are useful to you.

Use a readiness condition that matches the page

The script uses domcontentloaded as a quick navigation milestone, not proof that every image, font, or client-rendered section is ready. If the part you need appears asynchronously, wait for a visible selector or another condition specific to that page. For a heterogeneous URL list, make this configurable per URL or domain rather than waiting blindly on one selector that may not exist everywhere.

Rank #2
KODAK Dock Plus 4x6 Photo Printer, Smartphone Docking, 4PASS, 50 Sheets
  • Dock Photo Printer: The KODAK Dock Plus is a home photo printer that produces high-quality 4x6” prints directly from compatible smartphones. Featuring an integrated docking station, users can place their phone on the printer for better connection while simultaneously charging the device during printing.
  • Genuine 4PASS dye sublimation printing: Each photo is produced in three color layers and finished with a clear protective lamination layer. In approximately 55 seconds, you receive a smooth, detailed print designed to resist fingerprints, water, and fading for long-lasting quality.
  • Easy to Use: Print photos quickly without complicated setup or technical steps. Simply power on, connect wireless bluetooth, and start printing within seconds. The Dock Plus is built for straightforward operation, making it ideal for first time users and everyday photo printing.
  • Home Printing Station: Designed for stable desktop use, this dock photo printer connects to a power outlet for consistent performance and larger 4x6” prints. Ideal for home printing, photo albums, framing, family events, and everyday picture printing.
  • KODAK Photo Printer APP: Featuring integrated Bluetooth connectivity, this portable printer connects to compatible iOS and Android devices through the KODAK Photo Printer app. Edit, crop, and customize your photos before printing for creative results.

Playwright offers commit, domcontentloaded, load, and networkidle for the waitUntil option. The Playwright Page API describes networkidle as discouraged for general testing and says to use assertions to assess readiness instead: Playwright Page API. Pages may keep connections open or load content after network traffic settles, so network silence is not a reliable substitute for checking the content you intend to show.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose what the thumbnail represents

  • Viewport: the script’s default. It captures the currently visible area, usually a sensible starting point for a compact preview.
  • Full page: use await page.screenshot({ path: outputPath, fullPage: true }); when the whole scrollable document should be represented. Very long pages can produce large images.
  • Element: use await page.locator('main').screenshot({ path: outputPath }); to capture a specific component. Choose a selector that is stable on the target site.

Playwright can write screenshots to a path or return image bytes for downstream processing. Its screenshot documentation covers full-page and element captures as well as buffers: Playwright screenshot documentation and Playwright screenshot guide source.

Rank #3
Nelko PP01 Photo Printer, 2x3 Portable Photo Printer, Mini Printer, White
  • 2x3" Portable Photo Printer: The upgraded PP01 photo printer uses advanced inkjet technology. This portable photo printer produces vivid, full-color prints on premium sticky-backed photo paper that is smudge-proof, water-resistant, and tear-resistant. The Nelko mini photo printer is pocket-sized and weighs only 308g, making it ultra-portable for school, travel, and field trips. Each ink cartridge prints up to 80 full-color 2x3 photos on sticky-backed paper
  • Easy Printing via Bluetooth: The PP01 mini photo printer is compatible with iOS and Android phones via Bluetooth. Simply download the Nelko app from Google Play or the App Store. Load the 2x3 photo paper with the smooth side facing down. Install the ink cartridge, connect via Bluetooth, and print directly using the Nelko app. A USB charging cable is included; the adapter is not included
  • High Photo Quality: This mini photo printer uses advanced inkjet technology for clear, vibrant prints. This portable photo printer produces 600 DPI high-resolution images with precise colors, capturing fine details and realistic tones. Each photo comes with adhesive backing, perfect for scrapbooks and preserving your memories. Personalize every photo for holidays, birthdays, or daily events
  • Powerful App: The Nelko 2x3" PP01 photo printer app lets you edit photos and offers a variety of frame designs, making it perfect for personalizing your photos for projects like scrapbooking or journaling. Download the Nelko app to create collages and customize photos with filters, graffiti, borders, stickers, text, AI image editing, and many other features. Edit photos on your phone, then send them to the Nelko app for instant printing in under 90 seconds
  • Versatile Usage Scenarios: This portable photo printer is ideal for travel journals, party favors, and family gatherings. Students use it for planners and photo printing. Crafters use it for DIY projects, custom labels, and scrapbooking. It's a practical tool for bloggers, small businesses, and event photographers to create instant giveaways. Perfect for Mother's Day surprises and heartfelt moments with loved ones using Nelko sticky-backed photo paper.

Resize or crop to the destination’s thumbnail dimensions

A browser viewport setting controls the captured page area; it does not define a publisher’s final thumbnail dimensions or crop policy. First capture the page at a useful viewport, then resize or crop the saved image (or screenshot buffer) with your image-processing library to match the destination. Decide whether to preserve the full frame with padding or crop to fill: cropping can remove page content near the edges, while preserving the frame can leave empty space.

The right dimensions, output format, and compression quality depend on where the thumbnail will be displayed; the Playwright screenshot API does not determine those destination requirements. PNG is lossless but may be larger. If your publishing pipeline accepts another image format, choose and encode it as a separate processing step.

Rank #4
Liene Amber M110 Bluetooth Photo Printer 80 Sheets, Portable Photo Printer for iPhone, Thermal Dye Sublimation, Picture Printer 60 Sheets 4x6 Paper & 20 Sheets 3" Square Sticker Paper & 2 Cartridges
  • Dual 4x6" & 3x3" Photo Printer Paper Tray Convenience: Seamlessly print both 6-inch standard photo paper and 3-inch sticky-backed paper with our innovative dual tray design. This compact phone photo printer for smartphone offers easy storage and quick access, making it perfect for diverse printing needs without taking up much space. Enjoy vibrant, high-quality prints every time.
  • Fast Bluetooth Connectivity: Experience lightning-fast printing with our liene photo printer's Bluetooth connection, which pairs in just 13 seconds. Enjoy a seamless and efficient printing experience, perfect for capturing and sharing memories on the go without the hassle of cables or complex setups.
  • Superior Quality Photo Printer 4x6 - Print photos like no other thanks to the thermal-dye sublimation tech adopted by the picture printer for iphone. The dyes deeply penetrate the paper for vibrant photo printing, and the laminated surface is resistant to water, scratches, fingerprints and fading. Get Liene photo printers now as amazing gifts for yourself and your loved ones, print your happy moments together and keep your love forever!
  • Multiple Device Compatibility - Liene picture printer for iphone provides instant photo printing for up to mutiple simultaneous connections. Share with family and friends or print from your different devices. No additional cables required when printing photos with this phone printer.
  • Customize your Printing with the Liene App - Customize your photos with our specialized App! You can add a Polaroid border, insert filters, enhance the contrast and brightness, check printing status, and more. You can even print your ID and Visa photos from home with this iphone photo printer for 4x6 & 3x3 prints.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Handle HTTP errors, timeouts, and retries deliberately

page.goto() can return a response with an HTTP error status such as 404 or 500 without throwing. The example checks the response and marks status codes of 400 or higher as http-error; decide whether your use case should instead save those pages for diagnosis. Navigation failures such as timeouts or unreachable sites are caught and logged as failed. See the Page API for navigation response and failure behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The JSON Lines manifest records the input URL, final URL after redirects, status when available, output path, result, and error message. It gives you a practical review and retry list. For production use, add a retry policy only for failures you expect to be transient, cap the number of attempts, and record each attempt so a persistent failure is not obscured.

Best Value
KODAK Mini 2 Retro 2x3 Portable Photo Printer, 4PASS, 38 Sheets, White
  • Instant Photo Printing: The KODAK Mini 2 Retro is a portable photo printer designed to turn smartphone pictures into high quality prints in seconds. Whether capturing family moments, travel highlights, journaling pages, or creative projects, this mini printer lets you print real photos anytime, anywhere.
  • Genuine 4PASS dye sublimation printing: Each photo is produced in three color layers and finished with a clear protective lamination layer. In approximately 55 seconds, you receive a smooth, detailed print designed to resist fingerprints, water, and fading for long-lasting quality.
  • Easy to Use: Print photos quickly without complicated setup or technical steps. Simply power on, connect wireless bluetooth, and start printing within seconds. The Mini 2 Retro is built for straightforward operation, making it ideal for first time users and everyday photo printing.
  • Print Anytime, Anywhere: Small enough to fit in your hand, bag, or even a pocket, the Mini 2 Retro is built for on-the-go printing. Ideal for parties, trips, school projects, scrapbooks, and spontaneous moments where you want real prints without waiting.
  • KODAK Photo Printer APP: Featuring integrated Bluetooth connectivity, this portable printer connects to compatible iOS and Android devices through the KODAK Photo Printer app. Edit, crop, and customize your photos before printing for creative results.

Performance, reliability, and cost considerations

  • Bound concurrency: more open pages can raise throughput but also consume memory, CPU, and network capacity. The documentation does not prescribe a worker count or publish a throughput guarantee for hundreds of arbitrary sites. Measure a representative subset on the machine that will run the batch.
  • Reuse the browser: the sample launches Chromium once and closes each page after its capture. This avoids launching a new browser process for every URL while keeping pages bounded.
  • Consider isolation: each new page has its own page state, but sites may still need cookies or a context shared across pages. Use browser contexts intentionally if authentication or session behavior matters.
  • Expect uneven runtimes: site response time, scripts, redirects, and content readiness vary. A timeout should be chosen for your workload and logged, not treated as proof that the site is permanently unavailable.
  • Plan storage: capture size depends on viewport, full-page length, and format. Check disk use and clean up or move outputs after validating the manifest.
  • Measure before scaling: benchmark a representative mix of fast, slow, redirected, and failing URLs. There is no universal URLs-per-minute figure for this workload.

Common problems and fixes

Symptom Likely cause What to do
A 404 or 500 page appears successful HTTP error responses do not necessarily throw from navigation. Inspect response.status() and decide whether to save the error page or mark it as failed.
The screenshot is blank or misses dynamic content The chosen navigation event happened before the relevant application content appeared. Wait for a visible, site-specific selector or other observable content condition before capturing.
Navigation times out The site is slow, unreachable, or held open by page behavior. Review the manifest error, select a timeout appropriate to the workload, and retry only under a capped policy.
Some outputs overwrite or have unusable names Raw URLs are unsuitable as filenames and can collide after sanitization. Use stable IDs or a collision-resistant identifier and retain the source URL in the manifest.
The batch exhausts memory or becomes unstable Too many pages are active for the machine or pages are unusually large. Lower WORKERS, capture viewport rather than full page where appropriate, and measure again.
The thumbnail dimensions do not match a site requirement Screenshot capture and final image sizing are separate operations. Resize or crop after capture to the exact destination specification.

Or skip the browser setup

If you prefer an API request to installing and managing a browser, ScreenshotNeo returns a screenshot or PDF from one GET request. Use it for a target URL and save the returned bytes as an image; consult the ScreenshotNeo documentation for API parameters and response handling.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be disabled. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients. The free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan to try up to 1,000 screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Does Playwright automatically create a thumbnail at a particular width and height?

No. Screenshot capture defines the captured page area; resize or crop the result separately to your destination’s required dimensions.

Can I capture an HTTP 404 page with Playwright?

Yes. Navigation can return a 404 response without throwing. Check the status and choose whether to save it for diagnosis or record it as an error.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.