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.

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 chromedp to navigate to the page and capture the area you need into a []byte; then use Go’s os.WriteFile to save those bytes. Choose chromedp.Screenshot for a visible element, chromedp.CaptureScreenshot for the current viewport, or chromedp.FullScreenshot for a full-page image.

Capture a webpage and save it as a PNG

This runnable example captures the current browser viewport. It creates a chromedp context, navigates to the target, writes the screenshot bytes to disk, and checks both browser and file errors. Replace the URL and filename as needed.

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/chromedp/chromedp"
)

func main() {
	ctx, cancel := chromedp.NewContext(context.Background())
	defer cancel()

	var image []byte
	err := chromedp.Run(ctx,
		chromedp.Navigate("https://example.com"),
		chromedp.CaptureScreenshot(&image),
	)
	if err != nil {
		panic(fmt.Errorf("capture screenshot: %w", err))
	}

	if err := os.WriteFile("screenshot.png", image, 0o644); err != nil {
		panic(fmt.Errorf("write screenshot: %w", err))
	}
}

The screenshot action fills the byte slice; os.WriteFile is a separate filesystem operation. The mode 0o644 makes the file readable by its owner and readable by others, subject to the process umask and operating system permissions. Make sure the destination directory exists and is writable.

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

Choose what to capture

Current viewport

Use chromedp.CaptureScreenshot(&image) to capture the browser’s current viewport. The screenshot will not automatically include content below the visible area.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

One visible element

Use chromedp.Screenshot with a selector to capture a visible page element. This example captures the first element matched by #main after navigation:

var image []byte
err := chromedp.Run(ctx,
	chromedp.Navigate("https://example.com"),
	chromedp.Screenshot("#main", &image, chromedp.NodeVisible),
)
if err != nil {
	return err
}
if err := os.WriteFile("element.png", image, 0o644); err != nil {
	return err
}

Put this code inside a function that returns an error, or adapt the error handling to your application. A selector is specific to the target page; sites can change their markup, so verify that the element exists and is visible before relying on it.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

Full page

Use chromedp.FullScreenshot when the capture must extend beyond the viewport. Its quality argument determines the image encoding: quality 100 produces PNG, while other values produce JPEG. Name the output file accordingly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
var image []byte
err := chromedp.Run(ctx,
	chromedp.Navigate("https://example.com"),
	chromedp.FullScreenshot(&image, 100),
)
if err != nil {
	return err
}
if err := os.WriteFile("full-page.png", image, 0o644); err != nil {
	return err
}

For a smaller JPEG, use a quality between 0 and 99 and a JPEG filename, for example chromedp.FullScreenshot(&image, 90) with full-page.jpg. Do not use a .png extension for that JPEG output.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Wait for page content when necessary

Navigating does not guarantee that every delayed or dynamically rendered element is ready at the exact moment the screenshot action runs. If a page’s relevant element appears later, add a wait action before capturing it. For example, wait for a stable selector:

err := chromedp.Run(ctx,
	chromedp.Navigate("https://example.com"),
	chromedp.WaitVisible("#main", chromedp.ByQuery),
	chromedp.Screenshot("#main", &image, chromedp.NodeVisible),
)

Choose a selector that belongs to the target page and is expected to appear. Waiting for a page-specific element is generally more reliable than assuming every site finishes its client-side rendering at the same time.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Full-page capture and device emulation

The chromedp screenshot example warns: “Note: chromedp.FullScreenshot overrides the device’s emulation settings. Use device.Reset to reset the emulation and viewport settings.” If your workflow configures a device or viewport and needs those settings after a full-page capture, reset them as appropriate before continuing. Check the chromedp version pinned in your Go module for the exact APIs available to your application.

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.

Common errors and fixes

  • chromedp.Run returns an error: Navigation or the screenshot action failed, so do not write or use the buffer as if capture succeeded. Return or log the error with context; confirm that the URL is reachable and that the selector exists if you are capturing an element.
  • The saved file is empty or missing: Check the chromedp.Run error before writing, check the os.WriteFile error, and confirm that the process can write to the selected directory.
  • The image shows only the top of the page: CaptureScreenshot captures the viewport. Use FullScreenshot for content beyond it.
  • The image extension does not match its contents: FullScreenshot with quality 100 produces PNG; other quality values produce JPEG. Match the filename extension to that encoding.
  • The expected device viewport changed after capture: Full-page capture overrides device emulation settings. Reset emulation and viewport settings when your later steps depend on them.
  • The selector capture fails or captures the wrong content: Recheck the selector against the page’s current HTML and wait for the desired visible node. Example selectors are not guaranteed to remain valid as external sites change.
  • The headless browser window is not visible: chromedp runs Chrome headlessly by default; a visible window is not required to produce a screenshot.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo provides a screenshot API: one GET request returns an image or PDF. This cURL example saves a WebP screenshot of https://example.com; see the ScreenshotNeo API documentation for parameters and response details.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers indicate the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo to get 1,000 free screenshots a month with no card.

Frequently Asked Questions

Which chromedp action captures a single element?

Use chromedp.Screenshot(selector, &image, chromedp.NodeVisible) for a visible selected element.

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

Does chromedp save the screenshot file automatically?

No. The screenshot action returns image bytes in a buffer; save them separately with Go file I/O such as os.WriteFile.

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.