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

To white out or black out part of a screenshot before printing, draw the screenshot into an HTML canvas, paint fully opaque rectangles over the regions to cover, and print or export that modified canvas. The covered pixels—not a separate overlay—must be what reaches the printer or PDF. This approach works for screenshots you can load into the page; for automated masking of known webpage elements, Playwright offers a different workflow.

Use canvas to cover screenshot regions

A canvas lets JavaScript draw an image and then replace selected areas with solid color. Use white for a white-out or black for a black-out. Because the rectangles are painted into the canvas bitmap, they cover the underlying screenshot when that bitmap is printed.

The HTML Standard describes a canvas as representing its current bitmap and size in static visual media, including print. See the WHATWG HTML Standard. MDN’s canvas element documentation also explains drawing images and the distinction between bitmap dimensions and CSS display dimensions.

Runnable example: load an image and paint rectangles

Save this as an HTML file, place a screenshot named screenshot.png beside it, and open the file in a browser. The example covers two pixel-coordinate regions, shows only the modified canvas in print, and includes buttons to change the cover color and open the print dialog.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Brother DCP-L2640DW Wireless Compact Monochrome Multi-Function Printer, Copy, Scan, Duplex, Mobile Printing
  • BEST FOR SMALL BUSINESSES – Engineered for extraordinary productivity, the Brother DCP-L2640DW Monochrome (Black & White) 3-in-1 combines laser printer, scanner, copier in one compact footprint and delivers high-quality black & white prints
  • FAST PRINTER WITH EFFICIENT SCANNING – Produces documents quickly with print speeds up to 36 ppm(2) and scan speeds up to 23.6/7.9 ipm(3) (black/color). A 50-page auto document feeder(4) allows for convenient, time saving multi-page scanning and copying
  • FLEXIBLE CONNECTION OPTIONS – Easily navigate the changing demands of your business with secure multi-device connectivity via built-in dual-band wireless (2.4GHz / 5GHz) and Ethernet. Or connect locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Print, scan, and manage your wireless printer anytime, from almost anywhere from your mobile device. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(5)
  • CHOOSE BROTHER GENUINE TONER – When it’s time to replace your toner, be sure to choose Brother Genuine TN830 or TN830XL replacement toner. And with Refresh EZ Print Subscription Service, you’ll never worry about running out of toner again and you’ll enjoy savings of up to 50%(6) on Brother Genuine Toner. Get started with Refresh today with a Free Trial(1)
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Cover screenshot areas before printing</title>
  <style>
    canvas { display: block; max-width: 100%; height: auto; border: 1px solid #999; }
    @media print {
      @page { size: auto; margin: 12mm; }
      body * { visibility: hidden; }
      #printArea, #printArea * { visibility: visible; }
      #printArea { position: absolute; inset: 0; width: 100%; }
      canvas { width: 100%; height: auto; border: 0; }
      .controls { display: none; }
    }
  </style>
</head>
<body>
  <div id="printArea">
    <canvas id="redacted"></canvas>
  </div>
  <div class="controls">
    <button id="white" type="button">White out</button>
    <button id="black" type="button">Black out</button>
    <button id="print" type="button">Print</button>
    <p id="status" role="status">Loading screenshot…</p>
  </div>
  <script>
    const image = new Image();
    image.src = "screenshot.png";
    const canvas = document.querySelector("#redacted");
    const context = canvas.getContext("2d");
    const regions = [
      { x: 80, y: 110, width: 240, height: 42 },
      { x: 80, y: 390, width: 180, height: 36 }
    ];
    let cover = "#fff";

    function draw() {
      canvas.width = image.naturalWidth;
      canvas.height = image.naturalHeight;
      context.drawImage(image, 0, 0);
      context.fillStyle = cover;
      for (const region of regions) {
        context.fillRect(region.x, region.y, region.width, region.height);
      }
      document.querySelector("#status").textContent =
        `Ready: ${canvas.width} × ${canvas.height} pixels`;
    }

    image.addEventListener("load", draw);
    image.addEventListener("error", () => {
      document.querySelector("#status").textContent =
        "Could not load screenshot.png. Check the filename and location.";
    });
    document.querySelector("#white").addEventListener("click", () => {
      cover = "#fff";
      draw();
    });
    document.querySelector("#black").addEventListener("click", () => {
      cover = "#000";
      draw();
    });
    document.querySelector("#print").addEventListener("click", () => window.print());
  </script>
</body>
</html>

The coordinates in regions are measured in the source image’s bitmap pixels, from its top-left corner. Change the rectangles to match the screenshot. The code redraws the original image each time the color changes, then applies the cover; this prevents repeated clicks from layering old fills over the source.

Why set the canvas dimensions from the image?

canvas.width and canvas.height determine its internal bitmap. Setting only CSS width or height changes how the bitmap is displayed and can scale it, which can blur or distort the output. The example uses the image’s natural pixel dimensions for the bitmap and CSS only to fit the preview to the screen or printed page. If you intentionally resize the bitmap, scale both the screenshot and the rectangle coordinates by the same factor.

Rank #2
Brother HL-L2405W Wireless Compact Monochrome Laser Printer with Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOMES & HOME OFFICES – Engineered for consistent, premium print quality, the Brother HL-L2405W Monochrome (Black & White) Laser Printer delivers sharp, crisp prints at an affordable price. Prints one-sided documents at speeds up to 30ppm(2)
  • COMPACT, CONNECTED PRINTER – Flexible connection options make this an ideal printer for home use and at-home offices. Securely connect to multiple devices with built-in dual-band wireless (2.4GHz/5GHz) or locally to a single computer via USB interface
  • BROTHER MOBILE CONNECT APP – Manage your printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Enjoy seamless, reliable everyday printing with the 250-sheet paper tray(4) and a manual feed slot that enables printing on envelopes and specialty pape
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

Make the cover truly opaque

For privacy, use an opaque fill such as #fff or #000. Do not rely on a visual overlay that sits above the image: if printing or exporting includes the original image instead of the overlay, the sensitive pixels may remain. Export or print the composed canvas itself.

Blur is not a dependable substitute for a solid cover. MDN documents CanvasRenderingContext2D.filter effects such as blur, but marks the property as having limited availability and not Baseline. See MDN’s CanvasRenderingContext2D.filter reference. A blur may also leave recognizable information; use opaque fills where unreadability is the goal.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Canon imageCLASS LBP6030w - Monochrome Single-Function Wireless Compact Wireless Laser Printer, 1 Year Limited Warranty, 19 PPM, White - Print Only
  • FAST PRINT SPEEDS: Print up to 19 pages per minute.
  • COMPACT DESIGN: Space-saving, compact design fits anywhere in your home, school or small office.
  • WIRELESS CONNECTIVITY: Print from almost anywhere in your workspace using your compatible mobile device.
  • PAPER CAPACITY: Up to 150 sheets.
  • SUSTAINABILITY: Uses less than 2 watts in Energy Saver mode.

Print the modified canvas or export it

Print from the browser

The example calls window.print(). Its @media print rules hide the controls and retain the canvas in the print area. The @page rule sets a margin; you can specify a paper size or orientation there when appropriate. Print behavior also depends on the browser’s print dialog and settings. Inspect Print Preview for scaling, clipping, unwanted blank pages, and whether the canvas is present before printing.

MDN’s printing with CSS guide covers print-specific styles and @page. Browser settings can override or interact with page layout rules, so the preview is the final check.

Rank #4
Brother HL-L2460DW Wireless Compact Monochrome Laser Printer with Duplex, Mobile Printing, Black & White Output | Includes Refresh Subscription Trial(1), Works with Alexa
  • BEST FOR HOME OFFICES & SMALL TEAMS – Engineered for consistent, premium print quality, the Brother HL-L2460DW Monochrome (Black & White) Laser Printer produces documents that are clear, crisp, and easy to review and share, all at an affordable price
  • COMPACT, CONNECTED, EXCEPTIONALLY EFFICIENT– Connect with built-in dual-band wireless (2.4GHz/5GHz), Ethernet, or to a single computer via USB interface. Prints at speeds up to 36ppm(2), plus automatic duplex printing saves time and reduces paper waste
  • BROTHER MOBILE CONNECT APP – Manage your wireless printer remotely and print from your mobile device anytime, from almost anywhere. Order Brother Genuine Supplies, track toner usage, and complete more work on-the-go(3)
  • VERSATILE PAPER HANDLING – Tackle high-volume black & white printing with the 250-sheet capacity paper tray.(4) The manual feed slot enables printing on envelopes and specialty paper
  • BROTHER IS AT YOUR SIDE – Backed by Brother with a 1-year limited warranty and free online, call, or live chat support for the life of your printer

Export a PNG file instead

To download the modified bitmap and print it from another application, add this handler after the canvas is drawn:

function downloadRedactedPng() {
  canvas.toBlob((blob) => {
    if (!blob) {
      document.querySelector("#status").textContent = "PNG export failed.";
      return;
    }
    const link = document.createElement("a");
    const objectUrl = URL.createObjectURL(blob);
    link.href = objectUrl;
    link.download = "redacted-screenshot.png";
    link.click();
    URL.revokeObjectURL(objectUrl);
  }, "image/png");
}

Call downloadRedactedPng() from a button click after the image has loaded. PNG is a lossless choice for a screenshot. Exporting a modified bitmap makes the filled areas part of the exported image; still open the downloaded file and verify it before sharing or printing.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
HP LaserJet M209dw Wireless Printer, Print, Fast speeds, Easy Setup, Mobile Printing, Best-for-Small Teams, Instant Ink Eligible
  • HP LaserJet M209dw Wireless Printer, Print, Fast speeds, Easy setup, Mobile printing, Best-for-small teams, Instant Ink eligible
  • Perfect for small teams printing black & white documents and reports, plus auto two-sided printing. Perfect for 1-5 people
  • FASTEST TWO-SIDED PRINTING IN ITS CLASS – Up to 30 black-and-white pages per minute single-sided, u up to 19 black-and-white images per minute two-sided printing
  • DUAL-BAND WI-FI WITH SELF-RESET – Automatically detects and resolves connectivity issues
  • STRONG SECURITY – Built-in security features help protect your printer from potential attacks
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose between interactive canvas editing and automated masking

Workflow Best suited to How regions are defined Output considerations
Canvas editing in a page A person covering selected areas in an existing screenshot Image pixel coordinates, or a selection UI you build Print or export the modified canvas bitmap; ensure the coordinates match the original image
Playwright locator masking Automated capture of a page when sensitive content has stable DOM locators Page elements selected with locators Masking applies during screenshot capture; PDF output uses print CSS media by default

Playwright’s screenshot API documents masking selected locators with a solid-color box, and its page.pdf() documentation describes PDF generation and print-media behavior. This is a page-capture technique, not a general editor for arbitrary screenshot regions. Consult the Playwright Page API if your input is a live page and the elements can be selected reliably.

Common problems and fixes

  • The cover is misplaced: Rectangle coordinates are relative to the source bitmap, not the displayed CSS size. Use natural pixel dimensions or convert screen coordinates by the display-to-bitmap scale ratio.
  • The printed screenshot is cropped or too small: Review print preview and adjust the canvas’s print width, @page margins, paper size, and orientation. A page that is taller or wider than printable space may be scaled by the browser.
  • The screenshot does not appear: Confirm the image path and filename, wait for its load event before drawing, and inspect the browser console for loading errors. If the image comes from another origin, canvas export can be restricted unless the server permits cross-origin image access; loading a local file avoids that remote-origin issue.
  • Export fails after drawing a remote image: A cross-origin image without suitable CORS permission can taint the canvas, preventing export. Serve the image from the same origin or configure the image host to allow the requesting origin, then set image.crossOrigin = "anonymous" before assigning image.src.
  • The cover looks transparent: Use an opaque CSS color such as #fff or #000, not an alpha color like rgba(0, 0, 0, 0.4).
  • The browser prints the unmodified image: Ensure the print stylesheet includes the canvas and not a separate original image element. In the example, only the canvas is placed in #printArea.
  • The output looks soft: Keep the canvas bitmap at the source image’s native dimensions; avoid enlarging a smaller bitmap for print. CSS changes its presentation size, not its source detail.

Or skip the browser setup

For a screenshot capture pipeline, ScreenshotNeo can return a screenshot or PDF with one request. Its clean-shot steps accept cookie/consent banners and remove 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, 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.

For example, this cURL request captures a page as WebP. See the ScreenshotNeo API documentation for options and response details.

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

The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. ScreenshotNeo captures webpages; use the canvas workflow above when you need to choose and redact arbitrary regions of an existing screenshot. Sign up for ScreenshotNeo’s free plan.

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

Frequently Asked Questions

Can I use this method to hide information in a screenshot before saving it?

Yes. Export the composed canvas, then open the exported file and confirm the covered regions are solid before sharing it.

Can I print several modified screenshots on one page?

Yes. Place each modified canvas in the print area and adjust the print layout, then check Print Preview for scaling and page breaks.

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.