To export a sharp JPG from HTML, control two independent variables: the rendered pixel dimensions (using a capture scale or viewport size) and JPEG compression quality. For a selected element in the browser, html2canvas renders the DOM into a canvas that you can encode with canvas.toBlob("image/jpeg", quality). For a screenshot of the browser’s actual rendering, use Playwright’s page screenshot API with JPEG, quality, full-page, and scale options.
Choose html2canvas for a client-side element export and Playwright for repeatable automation or maximum fidelity. Neither method can create detail that was absent from the source images or bypass browser security rules.
Decide what “high resolution” means
A large file is not automatically a high-resolution image. Before writing code, define the layout size and output pixels:
- CSS dimensions: the element’s displayed width and height.
- Scale: a multiplier that determines how many output pixels represent each CSS pixel.
- JPEG quality: a lossy-encoding value. Higher quality generally increases file size; it does not increase pixel count.
For example, a 1,200 × 800 CSS-pixel card at scale: 2 produces a canvas of about 2,400 × 1,600 pixels. Inspect the resulting canvas dimensions rather than assuming the browser produced the size you intended. A larger scale cannot restore detail from a small source image.
#1 Best Overall
- 24.1 Megapixel CMOS (APS-C) sensor with is 100–6400 (H: 12800)
- Built-in Wi-Fi and NFC technology
- 9-Point AF system and AI Servo AF
- Optical Viewfinder with approx 95% viewing coverage
- Use the EOS Utility Webcam Beta Software (Mac and Windows) to turn your compatible Canon camera into a high-quality webcam. Compatible Lenses- Canon EF Lenses (including EF-S lenses, excluding EF-M lenses)
Export an HTML element with html2canvas
1. Load the library and select the element
Include html2canvas in your page using the project’s normal distribution method, then identify the element to export. The library reconstructs an image from DOM information and supported CSS; it does not take a literal screenshot of the screen.
2. Render at an explicit scale
The documented default for scale is the browser’s window.devicePixelRatio. Set it yourself when predictable dimensions matter. The following example renders a card at twice its CSS resolution and exports a high-quality JPG:
const element = document.querySelector("#capture");
if (!element) throw new Error("#capture was not found");
const scale = 2;
const canvas = await html2canvas(element, {
scale,
// Set these when you need a fixed viewport for responsive layouts:
// windowWidth: document.documentElement.scrollWidth,
// windowHeight: document.documentElement.scrollHeight
});
console.log(`Output pixels: ${canvas.width} × ${canvas.height}`);
canvas.toBlob((blob) => {
if (!blob) throw new Error("Could not export canvas");
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = "capture.jpg";
link.click();
URL.revokeObjectURL(url);
}, "image/jpeg", 0.95);
toBlob() accepts a JPEG quality value from 0 to 1. A value such as 0.95 favors visual quality over file size; choose and test a value appropriate for your use. Check the returned blob’s MIME type because an unsupported requested format can fall back to PNG.
3. Export reliably from a user action
Run the capture in a click handler or another user-initiated flow when possible. Wait for images and fonts to finish loading before calling html2canvas. If content appears after an API request, wait for your application’s completion signal rather than relying on an arbitrary short delay.
Recommended Free Tools
Rank #2
- 【8K UHD 88MP Autofocus Digital Camera】 This 2026 upgraded digital camera captures stunning 88MP high-resolution photos and records immersive 8K videos with rich detail. Featuring a 16x zoom lens, it easily transitions from wide landscapes to close-up shots, helping you capture sharp and vibrant moments during travel or daily life. The fast autofocus system allows you to half-press the shutter for quick focus locking and clearer images.
- 【Dual-Lens & Touchscreen Control】Designed with both front and rear lenses, this cameras for photography is ideal for selfies, vlogging, and group photos. Built-in anti-shake and responsive autofocus help reduce blur and improve image clarity. The 3.2-inch HD touchscreen offers smooth operation and easy framing, making this point and shoot digital camera simple to use for beginners and everyday shooting.
- 【Wi-Fi Sharing & HDMI Output】Built-in Wi-Fi allows you to quickly transfer photos and videos to your smartphone for instant social media sharing. Connect the 8k digital camera to a TV or monitor through HDMI for a larger viewing experience. It can also function as a webcam for live streaming, video chats, online classes, or meetings, making it suitable for both entertainment and creative content creation.
- 【Versatile Vlogging Camera with Flash】Made for content creators, this cameras for photography includes a hot shoe mount for connecting external microphones or fill lights to enhance audio and lighting quality. The built-in flash supports clearer shooting in low-light environments. With the included 64GB card and two rechargeable batteries, you can enjoy extended shooting time without interruption. (Note: minimum focusing distance is 10 cm; macro lens not included.)
- 【Gift-Ready Package】Compact and lightweight at only 5 × 2.8 × 3.4 inches, this digital camera is perfect for travel and everyday photography. Package includes: 1 × 8K cameras for photography, 2 × Batteries, 1 × 64GB TF Card, 1 × USB Cable, 1 × HDMI Cable, 1 × Charger, 1 × Lens Hood, 1 × Lens Cap, 1 × Camera Bag, 1 × Cleaning Cloth, 1 × Manual, and 1 × Strap. Supported by 24/7 customer service, it makes a thoughtful christmas gifts, birthday gifts for women, and anniversary gifts for men.
Use a solid background for JPG
JPEG has no transparency. If the element can be transparent, set a background color in the capture options or CSS so transparent areas do not become an unexpected dark or black color in another viewer.
Capture the actual browser rendering with Playwright
Use Playwright when CSS fidelity, responsive behavior, authenticated pages, or repeatable server-side jobs matter. Its Page screenshot API captures what the browser renders instead of rebuilding the image from DOM data.
import { chromium } from "playwright";
const browser = await chromium.launch();
const page = await browser.newPage({
viewport: { width: 1440, height: 900 },
deviceScaleFactor: 2
});
await page.goto("https://example.com", { waitUntil: "networkidle" });
await page.screenshot({
path: "page.jpg",
type: "jpeg",
quality: 95,
fullPage: true,
scale: "device"
});
await browser.close();
Playwright documents quality from 0 to 100 (with a documented default of 80), type: "jpeg", fullPage, and scale: "css" or "device". The browser context and viewport determine the page’s layout; the screenshot scale determines whether output follows CSS pixels or device pixels. For one component, locate it and screenshot its bounding box or locator rather than capturing the entire page.
html2canvas or Playwright?
| Decision axis | html2canvas | Playwright screenshot |
|---|---|---|
| Where it runs | In the page/browser | In browser automation |
| What it captures | A reconstruction of a selected DOM element | The browser-rendered page or region |
| Resolution control | scale, element dimensions and canvas size |
Viewport, device characteristics and css/device scale |
| JPEG control | toBlob("image/jpeg", quality), quality 0–1 |
type: "jpeg", quality 0–100 |
| Main constraint | Supported CSS and cross-origin canvas rules | Requires a Playwright browser workflow |
The html2canvas documentation cautions that its output may not be 100% accurate because it is based on the DOM rather than an actual screenshot. If a pixel-level match to what users see is important, prefer a browser screenshot.
Rank #3
- 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
- Optical Zoom: 5x optical zoom with a 28mm wide angle lens for flexible framing indoors or outdoors
- Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
- Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
- LCD Screen and Battery: 2.7in LCD screen and a rechargeable lithium-ion battery for on-the-go use
Full-page, responsive and high-DPI captures
Full-page pages
For Playwright, use fullPage: true. For html2canvas, capture the intended container and provide windowWidth and windowHeight based on its scroll dimensions when responsive content is clipped. Very large canvases can exceed browser- or platform-specific limits; those limits vary, so validate the exact target browser and split exceptionally long documents into sections if necessary.
Retina and print-oriented output
Choose a scale based on the final use: a scale of 2 often gives a practical high-density export, while a larger value increases memory and encoding time. Confirm the actual width and height of the output. For print, calculate the pixels required by the target physical size and resolution, then ensure source images are large enough; scaling a low-resolution photograph only enlarges its pixels.
Responsive layouts
Set Playwright’s viewport explicitly or capture at the same viewport used by your application. With html2canvas, the element’s current layout is captured; changing the browser width can trigger different breakpoints. Freeze animations, hide transient UI, and wait for web fonts before capture when deterministic output matters.
Common failures and fixes
Images are missing or the export throws a security error
Images loaded from another origin need appropriate CORS permission or a server-side proxy. Otherwise the canvas becomes tainted and the browser blocks reading or exporting it. html2canvas cannot bypass these content policies. Cross-origin iframes likewise cannot be inspected by the library.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesRank #4
- 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
- Optical Zoom: 4x optical zoom with a 27mm wide angle lens for flexible framing indoors or outdoors
- Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
- Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
- LCD Screen and Battery: 2.7in LCD screen with 2 AA alkaline batteries for convenient on-the-go use
The JPG looks different from the page
Unsupported CSS, pseudo-elements, filters, videos, or cross-origin content can differ in html2canvas. Check the library’s supported-features documentation for the specific property. Use Playwright when the rendered browser view is the requirement.
The output is blank or clipped
Verify that the selector exists, the element is visible, and images and fonts have loaded. For long captures, set appropriate window dimensions and test in the target browser. Canvas area limits vary by browser, operating system and device; there is no universal maximum.
The file is soft despite high quality
Log canvas.width and canvas.height, inspect the source image dimensions, and increase scale only when the source and memory budget support it. JPEG quality changes compression, not pixel count.
The downloaded file is PNG
Pass "image/jpeg" explicitly and inspect blob.type. Browsers may fall back to PNG when the requested MIME type is unsupported.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Best Value
- 2026 Next-Gen 96MP 8K Digital Camera with Flash : Capture life’s most vibrant moments with this advanced 8K Ultra HD camera. Powered by a latest-generation CMOS sensor, it delivers breathtaking 96MP stills and cinematic video. The integrated high-output flash ensures professional-grade clarity in low-light or night settings. Featuring upgraded Auto-Focus, the lens locks onto subjects with pinpoint accuracy, maintaining sharp detail even in high-contrast or bright-light environments.
- 8K Digital Camera with WiFi Transfer that syncs to phone & Latest Powerful 20X Precision Zoom : Elevate your social media game with built-in WiFi transfer. Using the "Viipulse" app for iOS and Android, you can instantly share your content to YouTube, TikTok, or Facebook. Whether you are capturing distant landscapes or fine details, the 20X digital zoom controlled by the ergonomic W/T rocker allows for smooth, effortless transitions during both video recording and photography.
- Professional Vlogging & Webcam Functionality : Designed for creators, this vlogging camera features a 3.5" 180°Flip LCD Screen, making it easy to frame the perfect selfie or vlog. Connect to your PC to activate Webcam Mode for high-quality live streaming, online teaching, or Zoom calls using the built-in high-fidelity microphone. Its intuitive interface makes it an ideal choice for beginners, students, and aspiring photographers of all ages.
- Supports HDR imaging & Ultra-Portable Design :Compared to regular cameras that don't support HDR (High Dynamic Range) imaging, our cameras have significant advantages in image quality, detail representation and realism. Constructed from premium, eco-friendly materials, this compact cameras for photography is built for the rigors of travel. From rugged hiking,camping trips,school projects to daily vlogging,birthday party, Wedding and sports,this Small digital camera is ready for any adventure.
- Creative Versatility & 2 Batteries : This feature-rich travel camera includes professional tools like Anti-Shake, HDR Imaging, Slow Motion, Continuous Shooting and Self-timer. 60 Filters Available, you can take regular pictures as well as black and white, classic film, vintage, blue, and other fun filters you can choose.To ensure you never miss a shot, we include two high-capacity batteries. Our dedicated 24/7 technical support team is ready to assist with troubleshooting and setup at any time.
The page is incomplete in automation
Wait for the relevant state: page.goto(..., { waitUntil: "networkidle" }) is one option, but application-specific selectors are often more reliable. Scroll or trigger lazy-loaded content before a full-page screenshot, and supply authentication, cookies, or headers required by the page.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF, with options for full-page captures, lazy images, CSS-selector elements, dark mode, device presets, retina scale, custom CSS and JavaScript, waits, cookies, headers, user agents, geolocation, request blocking, resizing, caching, signed links, asynchronous webhooks and bulk capture.
It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients.
See the ScreenshotNeo API documentation for parameters and authentication. This cURL request saves a WebP; change the URL or request options for your workflow:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Equivalent Python and Node.js calls:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
The Free plan includes 1,000 screenshots per month without a card. Paid plans start at $5 for 3,000 shots; every feature is included on every plan. Create a free ScreenshotNeo account.
Performance, reliability and cost checklist
- Keep scale and viewport no larger than the final use requires.
- Prefer
toBlob()overtoDataURL(); data URLs create a large in-memory string and can cause performance or URL-length problems. - Wait for deterministic page state, then record output dimensions and MIME type.
- Use browser automation for exact rendering, and test large pages on the deployment browser and device.
- For repeated remote captures, use caching, asynchronous jobs or bulk requests where appropriate, and inspect billing verdict headers.
Frequently Asked Questions
Can I convert an existing PNG screenshot to a sharper JPG?
You can encode the PNG as JPEG, but conversion cannot add missing detail. Capture the HTML at the required pixel dimensions instead.
What JPEG quality should I choose?
Start with a high value such as 0.9–0.95 for canvas or 90–95 in Playwright, then inspect text, gradients and file size for your particular page.
Is html2canvas suitable for cross-origin pages?
Only when images and frames satisfy browser CORS and same-origin rules. It cannot bypass those restrictions; use a controlled browser or server-side capture when necessary.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Quick 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.

