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

The reliable fix is to treat takeSnapshot as an asynchronous, main-thread capture of a settled WebKit view. Wait for navigation and JavaScript layout to finish, capture on the main actor with afterScreenUpdates = true, use a rectangle in the web view’s coordinate system, and set snapshotWidth deliberately. Log both the returned image and error. If ordinary HTML appears but video, WebGL, filters, or 3D effects are black, you are seeing a WebKit rendering limitation rather than a timing bug.

This guide shows a diagnostic Swift implementation, explains full-page geometry, identifies why common fallbacks produce white or clipped images, and gives recovery paths for GPU-heavy pages.

What a blank or partial image means

WKWebView.takeSnapshot(with:completionHandler:) reports two independent results: an optional platform image and an optional error. A nil image with an error indicates that the capture operation failed. A non-nil image with the expected dimensions can still contain transparent, white, black, or incomplete content. In that case, investigate readiness, geometry, or unsupported rendering instead of assuming the API succeeded visually.

  • Blank or transparent: the first frame may not have been presented, the requested rectangle may be outside the rendered area, or the page may still be laying itself out.
  • Correct size but only part of the page: the rectangle or document dimensions were measured before images, fonts, lazy content, or script-driven layout settled.
  • Black video or WebGL region: hardware-composited content is not guaranteed to be reproduced by WebKit snapshotting.
  • White image and an error: record the error before changing capture APIs; it is an API or lifecycle failure, not evidence that a different renderer will work.

Run the diagnostic sequence in this order

1. Verify completion, dimensions, scale, and alpha

Never save the image without inspecting the completion values. Log the error’s domain, code, and message; the image’s point size; the underlying pixel dimensions; and its scale. A valid image object only proves that WebKit returned a bitmap, not that the intended pixels were rendered.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Apple iPad 11-inch: A16 chip, 11-inch Model, Liquid Retina Display, 128GB, Wi-Fi 6, 12MP Front/12MP Back Camera, Touch ID, All-Day Battery Life — Blue
  • WHY IPAD — The 11-inch iPad is now more capable than ever with the superfast A16 chip, a stunning Liquid Retina display, advanced cameras, fast Wi-Fi, USB-C connector, and four gorgeous colors.* iPad delivers a powerful way to create, stay connected, and get things done.
  • PERFORMANCE AND STORAGE — The superfast A16 chip delivers a boost in performance for your favorite activities. And with all-day battery life, iPad is perfect for playing immersive games and editing photos and videos.* Storage starts at 128GB and goes up to 512GB.*
  • 11-INCH LIQUID RETINA DISPLAY — The gorgeous Liquid Retina display is an amazing way to watch movies or draw your next masterpiece.* True Tone adjusts the display to the color temperature of the room to make viewing comfortable in any light.
  • IPADOS + APPS — iPadOS makes iPad more productive, intuitive, and versatile. With iPadOS, run multiple apps at once, use Apple Pencil to write in any text field with Scribble, and edit and share photos.* iPad comes with essential apps like Safari, Messages, and Keynote, with over a million more apps designed specifically for iPad available on the App Store.
  • FAST WI-FI CONNECTIVITY — Wi-Fi 6 gives you fast access to your files, uploads, and downloads, and lets you seamlessly stream your favorite shows.
webView.takeSnapshot(with: configuration) { image, error in
    if let error {
        print("takeSnapshot error: (error.localizedDescription)")
    }

    guard let image else {
        print("No image returned")
        return
    }

    print("points: (image.size), scale: (image.scale)")
    if let cgImage = image.cgImage {
        print("pixels: (cgImage.width)x(cgImage.height), alphaInfo: (cgImage.alphaInfo.rawValue)")
    }

    // Only write the file after the diagnostics above have been recorded.
    if let data = image.pngData() {
        try? data.write(to: outputURL, options: .atomic)
    }
}

If the image is opaque but uniformly white or black, inspect page readiness and the requested geometry next. If the alpha channel is transparent over the region you expected to see, check that the rectangle intersects the current web view bounds.

2. Capture on the main actor after the page is ready

Call the API on the main actor (or main thread for older UIKit code). Start the capture from webView(_:didFinish:), not immediately after assigning the URL. A finished navigation can still be followed by JavaScript layout, web fonts, image decoding, lazy loading, and application code that changes the DOM.

After navigation completes, dispatch the capture to the next run-loop turn or wait for a page-specific readiness signal. Set afterScreenUpdates to true so pending screen updates are incorporated. This property exists for precisely the case where WebKit has changed the view but the display update has not yet been committed.

For pages you control, expose a JavaScript flag after the final layout step, or wait for a selector that only appears when the page is ready. For third-party pages, combine didFinish with a short, bounded delay and a retry that records why it was needed; do not retry indefinitely.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Apple iPad 11-inch: A16 chip, 11-inch Model, Liquid Retina Display, 128GB, Wi-Fi 6, 12MP Front/12MP Back Camera, Touch ID, All-Day Battery Life — Silver
  • WHY IPAD — The 11-inch iPad is now more capable than ever with the superfast A16 chip, a stunning Liquid Retina display, advanced cameras, fast Wi-Fi, USB-C connector, and four gorgeous colors.* iPad delivers a powerful way to create, stay connected, and get things done.
  • PERFORMANCE AND STORAGE — The superfast A16 chip delivers a boost in performance for your favorite activities. And with all-day battery life, iPad is perfect for playing immersive games and editing photos and videos.* Storage starts at 128GB and goes up to 512GB.*
  • 11-INCH LIQUID RETINA DISPLAY — The gorgeous Liquid Retina display is an amazing way to watch movies or draw your next masterpiece.* True Tone adjusts the display to the color temperature of the room to make viewing comfortable in any light.
  • IPADOS + APPS — iPadOS makes iPad more productive, intuitive, and versatile. With iPadOS, run multiple apps at once, use Apple Pencil to write in any text field with Scribble, and edit and share photos.* iPad comes with essential apps like Safari, Messages, and Keynote, with over a million more apps designed specifically for iPad available on the App Store.
  • FAST WI-FI CONNECTIVITY — Wi-Fi 6 gives you fast access to your files, uploads, and downloads, and lets you seamlessly stream your favorite shows.

3. Use a rectangle and width that describe the current view

WKSnapshotConfiguration.rect is expressed in the WKWebView’s coordinate system, not in document CSS pixels and not in screen pixels. Begin with webView.bounds as a viewport test. A rectangle based on an old frame, an old scroll position, or a stale content-size measurement can have the right nominal dimensions while intersecting little or none of the rendered content.

snapshotWidth controls the output width in points. It is separate from the device’s pixel density. Choose the point width you need, then let the image scale determine its pixel dimensions. Do not multiply the value by the screen scale unless you specifically want that larger point width.

@MainActor
func captureViewport(of webView: WKWebView, to outputURL: URL) {
    let configuration = WKSnapshotConfiguration()
    configuration.rect = webView.bounds
    configuration.snapshotWidth = NSNumber(value: Float(webView.bounds.width))
    configuration.afterScreenUpdates = true

    webView.takeSnapshot(with: configuration) { image, error in
        if let error {
            print("Snapshot failed: (error.localizedDescription)")
        }
        guard let image else { return }
        guard image.size.width > 0, image.size.height > 0 else {
            print("Snapshot returned an empty size")
            return
        }
        guard let data = image.pngData() else {
            print("Could not encode PNG")
            return
        }
        do {
            try data.write(to: outputURL, options: .atomic)
        } catch {
            print("Could not save snapshot: (error)")
        }
    }
}

4. Prove viewport capture before attempting full-page capture

First capture webView.bounds. If that image is correct, the API and current rendering path work for the visible viewport; any remaining defect is probably document geometry or an unsupported element. If even the viewport is blank, do not add full-page code yet—fix readiness or lifecycle first.

Full-page screenshots: measure the final DOM, then choose a bounded plan

A web view’s scrollView.contentSize can be stale or reflect a previous layout. Measure the document after the page has settled:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Apple iPad 11-inch: A16 chip, 11-inch Model, Liquid Retina Display, 128GB, Wi-Fi 6, 12MP Front/12MP Back Camera, Touch ID, All-Day Battery Life — Pink
  • WHY IPAD — The 11-inch iPad is now more capable than ever with the superfast A16 chip, a stunning Liquid Retina display, advanced cameras, fast Wi-Fi, USB-C connector, and four gorgeous colors.* iPad delivers a powerful way to create, stay connected, and get things done.
  • PERFORMANCE AND STORAGE — The superfast A16 chip delivers a boost in performance for your favorite activities. And with all-day battery life, iPad is perfect for playing immersive games and editing photos and videos.* Storage starts at 128GB and goes up to 512GB.*
  • 11-INCH LIQUID RETINA DISPLAY — The gorgeous Liquid Retina display is an amazing way to watch movies or draw your next masterpiece.* True Tone adjusts the display to the color temperature of the room to make viewing comfortable in any light.
  • IPADOS + APPS — iPadOS makes iPad more productive, intuitive, and versatile. With iPadOS, run multiple apps at once, use Apple Pencil to write in any text field with Scribble, and edit and share photos.* iPad comes with essential apps like Safari, Messages, and Keynote, with over a million more apps designed specifically for iPad available on the App Store.
  • FAST WI-FI CONNECTIVITY — Wi-Fi 6 gives you fast access to your files, uploads, and downloads, and lets you seamlessly stream your favorite shows.
let script = """
(() => {
  const body = document.body;
  const root = document.documentElement;
  return {
    width: Math.max(body ? body.scrollWidth : 0, root.scrollWidth),
    height: Math.max(body ? body.scrollHeight : 0, root.scrollHeight)
  };
})()
"""

webView.evaluateJavaScript(script) { value, error in
    if let error {
        print("DOM measurement failed: (error.localizedDescription)")
        return
    }
    guard let metrics = value as? [String: Any],
          let width = metrics["width"] as? Double,
          let height = metrics["height"] as? Double,
          width > 0, height > 0 else {
        print("DOM returned no usable dimensions")
        return
    }
    print("Final document: (width) x (height) CSS pixels")
    // Resize or lay out the capture view consistently, then create a
    // WKSnapshotConfiguration.rect that is valid in that view's coordinates.
}

For a long page, resize or otherwise lay out the capture view consistently before creating the configuration. Convert the measured document size into a capture rectangle that is actually valid in the web view’s coordinate space. Very tall pages, animated layouts, and GPU-heavy content may require tiled or section captures. takeSnapshot is not a guarantee that an arbitrarily long document will be reproduced in one bitmap.

Separate normal HTML problems from GPU rendering limits

HTML5 video and WebGL

WebKit Bug 198107 describes iOS 12.2 (AppleWebKit 605.1.15) snapshots with a black region where HTML5 video and WebGL should appear while surrounding HTML remains visible. The issue was still marked NEW when modified on 2025-06-08. If your symptom matches that pattern, repeated timing changes are unlikely to create the missing hardware-composited pixels.

3D transforms, filters, reflections, and related effects

WebKit Bug 221662 reports missing perspective, filter effects, reflections, and other GPU rendering features. The practical interpretation is fidelity-limited capture: ordinary DOM may be present while a composited effect is absent or black. Treat the affected element as unsupported for this path rather than silently shipping a misleading image.

Workable content substitutions

  • Replace video with a poster image or a static frame before capture.
  • Render a static DOM representation for export instead of relying on a live canvas or WebGL surface.
  • Use a dedicated media/frame extraction path when the actual video frame is required.
  • Use a visible-window capture only when the view can be shown without privacy, overlap, or platform-policy problems.

These are different products from “make takeSnapshot wait longer.” Choose the one that matches the pixels you must preserve.

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.
Rank #4
Apple iPad Pro 11-inch (M5): Ultra Retina XDR Display, 256GB, Landscape 12MP Front Camera/12MP Back Camera, LiDAR Scanner, Wi-Fi 7 with Apple N1, Face ID, All-Day Battery Life — Space Black
  • WHY IPAD PRO — iPad Pro with the Apple M5 chip delivers extraordinary performance for effortless productivity on a stunning display. Take on pro workflows with Neural Accelerators for AI and a redesigned iPadOS with game-changing capabilities.*
  • PERFORMANCE AND STORAGE — iPad Pro with M5 brings next-generation speed and the power of on-device AI to all your tasks.* Featuring up to 2TB of storage, 16GB of memory, and Neural Accelerators for next-level AI performance.*
  • IPADOS — Run pro apps and get more done with iPadOS 26 with Liquid Glass design and game-changing capabilities.* With an intuitive and flexible windowing system, you can control, organize, and manage your workflows like never before.
  • APPLE INTELLIGENCE — Apple Intelligence is the personal intelligence system that helps you communicate, express yourself, and get things done effortlessly with groundbreaking privacy protections at every step.*
  • 11-INCH ULTRA RETINA XDR DISPLAY — The world’s most advanced display, featuring extreme brightness, precise contrast, ProMotion, P3 wide color, and True Tone.* Nano-texture display glass available in 1TB and 2TB configurations

Why common fallback APIs return white, clipped, or incomplete images

UIKit and AppKit rendering APIs do not automatically solve WebKit’s compositing model.

Approach Ordinary HTML GPU/video/WebGL Off-screen or overlapped view Typical constraint
takeSnapshot Designed for WebKit page capture May omit or black out hardware-composited content Use a valid web-view rectangle; geometry must be current Asynchronous lifecycle and WebKit feature limits
drawViewHierarchy(in:afterScreenUpdates:) Can work for visible UIKit hierarchy Not a guarantee for WebKit GPU surfaces Requires a suitable view hierarchy and current rendering state Fidelity and performance vary with visibility and overlap
Layer rendering or AppKit cacheDisplayInRect Can produce white or empty WKWebView output Does not restore missing WebKit compositing Not a reliable off-screen substitute WebKit Bug 161450 records empty results for these techniques
Window capture Captures what the window actually exposes May show the visible hardware result Cannot reliably capture clipped, covered, or scroll-view content CGWindowListCreateImage is limited to visible portions of a parented window

Use drawViewHierarchy or window capture only after accepting their visibility and overlap requirements. Keep takeSnapshot as the primary path for ordinary page content because it is the WebKit API intended for asynchronous snapshots.

A production-ready Swift pattern

import UIKit
import WebKit

@MainActor
final class SnapshotController: NSObject, WKNavigationDelegate {
    let webView: WKWebView

    override init() {
        let configuration = WKWebViewConfiguration()
        self.webView = WKWebView(frame: .zero, configuration: configuration)
        super.init()
        webView.navigationDelegate = self
    }

    func load(_ url: URL) {
        webView.load(URLRequest(url: url))
    }

    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
        // Let script, images, fonts, and the first display update settle.
        DispatchQueue.main.async { [weak self, weak webView] in
            guard let self, let webView else { return }
            self.capture(webView)
        }
    }

    private func capture(_ webView: WKWebView) {
        guard !webView.bounds.isEmpty else {
            print("Web view has no bounds; lay it out before capturing")
            return
        }

        let configuration = WKSnapshotConfiguration()
        configuration.rect = webView.bounds
        configuration.snapshotWidth = NSNumber(value: Float(webView.bounds.width))
        configuration.afterScreenUpdates = true

        webView.takeSnapshot(with: configuration) { image, error in
            if let error {
                print("takeSnapshot error: (error)")
            }
            guard let image else {
                print("No image returned")
                return
            }
            print("Captured (image.size) points at scale (image.scale)")
            // Validate alpha/content for your app, then encode to PNG or JPEG.
        }
    }
}

This pattern deliberately refuses to capture a zero-sized view, logs the asynchronous error, waits one main-loop turn after navigation, and requests pending screen updates. For a real app, replace the generic “did finish” readiness point with a page-specific signal when you control the content.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting by symptom

Symptom Likely cause Fix
Completion returns nil image and an error Lifecycle, invalid configuration, or WebKit capture failure Log the complete error, verify a non-empty laid-out web view, and retry only after correcting the reported condition.
Image dimensions are correct but entirely transparent Rectangle does not intersect rendered content or the first frame is pending Use webView.bounds, capture on the main actor, set afterScreenUpdates = true, and wait for the next run-loop turn.
Top of page is present but lower sections are missing Stale document height, lazy content, or an invalid full-page rectangle Measure final DOM dimensions after layout, trigger required lazy loading, then build a bounded capture plan in web-view coordinates.
Only video or WebGL is black Known WebKit GPU/compositing limitation Use a poster/static representation, a media extraction path, or an appropriately visible capture; do not rely on retries.
CSS filters, reflections, or perspective disappear Unsupported or fidelity-limited GPU effects Export a flattened/static version or accept that this snapshot path cannot reproduce the effect.
AppKit layer/PDF method is white WKWebView does not render through that fallback as expected Return to takeSnapshot for normal HTML and use a visible-window fallback only with its documented constraints.
Window capture clips or omits content The parent window is covered, clipped, or the page is in a scroll view Make the needed region visible and unobstructed, or use DOM/static export instead.

Performance, reliability, and privacy decisions

  • Bound the work: use viewport captures or tiles for very tall pages instead of one unbounded bitmap.
  • Stabilize dynamic content: disable or freeze animations where you control the page, and wait for fonts and images that affect layout.
  • Make retries observable: record navigation state, rectangle, requested width, image dimensions, scale, alpha information, and error details.
  • Do not confuse points and pixels: choose snapshotWidth for the output point width and inspect the resulting pixel dimensions separately.
  • Protect page data: screenshots can contain authenticated or personal content. Keep captures in appropriate storage and avoid window-capture fallbacks that expose unrelated application UI.

Or skip the browser setup

If the target is a public website rather than an in-app WKWebView state, ScreenshotNeo returns a hosted-page screenshot through one request. Its cleanup step accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. It also offers an MCP server for AI agents with take_screenshot, get_page_info, and capture_pdf.

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.

See the ScreenshotNeo API documentation for options such as full-page capture, CSS-selector elements, device presets, retina scale, custom CSS or JavaScript, waits, request blocking, headers, cookies, geolocation, signed links, asynchronous jobs, bulk capture, caching, and PDF output.

Best Value
Sale
Apple iPad, 10.2-Inch, Wi-Fi, 32GB, Space Gray (Renewed)
  • Smart Connector. 3.5 mm headphone jack. Stereo speakers. On/Off - Sleep/Wake. Home/Touch ID sensor. Dual microphones. Volume up/down. Nano-SIM tray (cellular models). Lightning connector
  • A10 Fusion chip.
  • Touch ID fingerprint sensor,
  • 8MP back camera, 1. 2MP FaceTime HD front camera.
  • Stereo speakers.

cURL

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

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://stripe.com'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', buffer);

The free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 screenshots; higher plans are Growth ($15 for 15,000), Pro ($39 for 60,000), Scale ($99 for 250,000), and Business ($249 for 1,000,000). Yearly billing provides two months free, and every feature is included on every plan. Create a free ScreenshotNeo account to try the 1,000 monthly screenshots without adding a card.

FAQ

Can a successful capture still be unusable?

Yes. The completion handler can return a valid-sized image whose pixels are transparent, stale, or missing a composited effect. Validate the actual content, not only the object and dimensions.

Should I keep increasing the delay until the page looks right?

No. A bounded readiness strategy helps ordinary HTML, but no delay makes unsupported video, WebGL, or GPU effects become reproducible in takeSnapshot. Change the representation or capture method for those elements.

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

Is a visible-window screenshot equivalent to a full-page export?

No. Window APIs capture what is visible and unobstructed, so clipped, covered, or off-screen scroll-view content may be absent. Use DOM measurement and a valid snapshot plan for page content, or export a static representation.

Frequently Asked Questions

Can a successful capture still be unusable?

Yes. The completion handler can return a valid-sized image whose pixels are transparent, stale, or missing a composited effect. Validate the actual content, not only the object and dimensions.

Should I keep increasing the delay until the page looks right?

No. A bounded readiness strategy helps ordinary HTML, but no delay makes unsupported video, WebGL, or GPU effects become reproducible in takeSnapshot. Change the representation or capture method for those elements.

Is a visible-window screenshot equivalent to a full-page export?

No. Window APIs capture what is visible and unobstructed, so clipped, covered, or off-screen scroll-view content may be absent. Use DOM measurement and a valid snapshot plan for page content, or export a static representation.

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

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.