Use Playwright for .NET to open a page in Chromium and call Page.ScreenshotAsync with JPEG output. Set Type = ScreenshotType.Jpeg explicitly, choose a quality, and either save to a .jpg file or use the returned bytes. The example below captures the full page; omit FullPage or set it to false to capture only the viewport.
Install Playwright .NET and its browser
Add the Microsoft.Playwright package to your C# project. Playwright requires browser binaries as well as the library, so follow the official .NET library setup guide to install the browsers for your project and environment. The exact install command depends on the project setup; use the guide rather than assuming that adding the NuGet package alone makes Chromium available.
The example uses Chromium, an asynchronous console application, and the API documented in Playwright’s rolling .NET reference. No particular package version or runtime has been tested here; check the API reference for the Playwright version pinned by your project if an option is unavailable.
Save a webpage screenshot as a JPEG file
This complete example navigates to a page, captures its full scrollable area, and writes a JPEG file in the application’s current working directory:
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
using Microsoft.Playwright;
using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync();
var page = await browser.NewPageAsync();
await page.GotoAsync("https://example.com");
await page.ScreenshotAsync(new PageScreenshotOptions
{
Path = "webpage.jpg",
Type = ScreenshotType.Jpeg,
Quality = 85,
FullPage = true
});
Use an asynchronous entry point, such as top-level statements in a modern C# console project. The screenshot API accepts the JPEG type and a quality from 0 through 100; JPEG’s documented default quality is 80. The value 85 here is an example, not a universal best setting. JPEG is lossy, so inspect the output at the size and level of detail that matter to your use case.
Alternatively, set Path to a filename ending in .jpg or .jpeg and let Playwright infer the image format from the extension. If neither a format nor a recognizable extension is supplied, PNG is the default; specify the type or extension when JPEG output is required. These behaviors and screenshot options are documented in the Page API reference.
Choose what to capture
Viewport or full page
By default, a page screenshot covers the current viewport. Set FullPage = true to capture the full scrollable page. A full-page image can be much taller than the visible browser window; confirm that downstream systems can handle the resulting dimensions and file size. For an ordinary viewport shot, omit the option or set FullPage = false.
A rectangular region
Use the page screenshot’s Clip option when you need a rectangle rather than the whole viewport. Specify its x and y origin and its width and height in the API’s clip structure. Choose coordinates and dimensions that fall within the page area you intend to capture.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
A single element
For a specific element, use a locator screenshot instead of capturing the whole page and cropping afterward. The Playwright screenshot guide documents full-page, buffer, and element screenshot examples. Element capture is useful when the desired output is a component such as a chart or card, while a page-level clip is appropriate when the target is a known rectangle.
Set JPEG quality and image dimensions
Balance quality against file size
The JPEG Quality option accepts values from 0 through 100, and the documented default for JPEG is 80. Higher quality generally retains more image detail at the cost of larger output; lower quality can produce smaller files with more visible compression. The API documentation does not establish a best quality for every page, so compare the saved result against your own requirements instead of treating one number as a benchmark.
Choose CSS-pixel or device-pixel scaling
Screenshot scale affects output dimensions. CSS scaling produces one screenshot pixel per CSS pixel and can keep high-DPI captures smaller. Device-scale capture uses device pixels and may create a larger image. Set the screenshot Scale option according to how the image will be viewed or processed; check the API reference for the exact enum values supported by your installed version.
JPEG does not preserve transparency
OmitBackground is not applicable to JPEG. If your output needs a transparent background, JPEG is the wrong format; choose an image format that supports transparency and validate its output for your particular page.
Return JPEG bytes instead of saving locally
When Path is omitted, ScreenshotAsync returns a byte[]. That lets an application send the capture to object storage, attach it to a response, or pass it to an image-processing component without first writing a local file:
byte[] jpeg = await page.ScreenshotAsync(new PageScreenshotOptions
{
Type = ScreenshotType.Jpeg,
Quality = 85,
FullPage = true
});
// Pass jpeg to the next component, or save it when needed:
await File.WriteAllBytesAsync("webpage.jpg", jpeg);
The bytes are JPEG data because the type is explicitly set. If you omit both the path and the type, do not assume the returned bytes are JPEG: PNG is the default when no format is specified.
Or skip the browser setup
If you do not want to install and manage a browser for a one-off capture or a service, ScreenshotNeo provides a screenshot API. Its API accepts a URL in one GET request and can return PNG, JPEG, WebP, or PDF. For the JPEG example, request the target URL and save the response body:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
ScreenshotNeo API documentation covers the request options. The API’s default output may differ from the filename extension in this example, so set the documented format parameter for JPEG and use a matching .jpg filename in a real request.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #4
ScreenshotNeo removes cookie/consent banners, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes screenshot tools to AI agents, including Claude, Cursor, and other MCP clients. 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’s free plan to get 1,000 screenshots a month without a card.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshoot common problems
The browser does not launch
Installing the package does not by itself guarantee that the matching browser binaries are installed. Follow the Playwright .NET library guide’s browser installation instructions for the environment where the application runs. If your project pins a specific Playwright version, ensure the installed browser corresponds to that version.
The file is PNG instead of JPEG
Check that Type is set to ScreenshotType.Jpeg, or that the output path ends with .jpg or .jpeg. With no format specified, Playwright defaults to PNG. Also make sure the application is writing to the path you are inspecting.
The capture is cut off
A default page screenshot captures the viewport, not the entire scrollable document. Set FullPage = true for a full-page capture. If only a particular region is missing, review the clip coordinates and dimensions; if the target is an element, use a locator screenshot.
Best Value
The image looks soft or is larger than expected
Review both Quality and Scale. Quality controls JPEG compression, while scale affects pixel dimensions. CSS scale can keep high-DPI images smaller; device scale can produce larger images. Adjust one setting at a time and inspect the actual output, since the API documentation provides no universal quality or file-size guarantee.
Transparency is missing
JPEG does not support the transparent-background behavior represented by OmitBackground. Select a format with transparency support instead if transparency is a requirement.
The screenshot call fails or returns no usable result
Confirm that navigation completed successfully, that the destination is reachable from the machine running the browser, and that the requested path is writable if saving directly to a file. If capturing bytes, check that the returned array is passed to the intended consumer and that the content type matches the format you requested. The supplied API references do not establish a universal remedy for site-specific navigation failures.
Practical reliability and cost considerations
A local Playwright capture requires a browser installation and the resources to run it; its output is an image file or bytes your application can handle. Decide whether to capture a viewport, full page, clip, or element before building storage and processing around the result, because dimensions and payload size differ. JPEG quality and scale should be chosen against the downstream use rather than an assumed universal optimum.
For a browser-backed service, account for the setup you avoid as well as the service plan cost. ScreenshotNeo’s stated pricing is Free: 1,000 shots per month with no card; Starter: $5 for 3,000; Growth: $15 for 15,000; Pro: $39 for 60,000; Scale: $99 for 250,000; and Business: $249 for 1,000,000. Yearly billing gives two months free. Every feature is on every plan. Check the service’s current documentation and plan page before relying on pricing or request behavior.
Frequently Asked Questions
Can I save a Playwright screenshot directly as a JPEG in C#?
Yes. Set Type = ScreenshotType.Jpeg and provide a .jpg path, or use a .jpg or .jpeg extension for format inference.
What JPEG quality should I use?
Playwright accepts values from 0 through 100 and documents 80 as the JPEG default. Choose by inspecting the trade-off between detail and file size for your own output.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallQuick Recap
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.

