Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
HTML

How to Export High-Resolution JPG Images from HTML

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

To export a sharp JPG from HTML, control two independent settings: the rendered pixel dimensions (usually with a capture scale) and JPEG compression quality. For a browser-side element, html2canvas renders DOM content to a canvas, which you can encode with toBlob("image/jpeg", quality). For an image of the actual browser-rendered page, Playwright’s screenshot API is usually more faithful and supports JPEG quality, full-page capture and CSS/device scale modes.

Choose the right capture method

Decision axis html2canvas Playwright screenshot
Where it runs Inside the page and browser, selecting a DOM element In browser automation, capturing a page or configured region
Rendering basis Reconstructs the image from DOM information and supported CSS Captures the browser-rendered page
Resolution control scale, width and height options scale: "css" or "device"; browser context controls device characteristics
JPEG control Canvas toBlob(..., "image/jpeg", quality), quality from 0 to 1 type: "jpeg" and quality from 0 to 100
Main constraint CSS support and cross-origin canvas security Requires a Playwright browser-automation workflow

html2canvas is convenient for a user-triggered download of one component. It does not take a literal screen shot: its documentation explains that it builds an image from DOM information, so it may not exactly match the page. Use Playwright when pixel fidelity to the rendered browser, repeatability or server-side automation matters.

Export an HTML element with html2canvas

1. Load the library and select the element

Install or include html2canvas using the method appropriate for your application, then identify the element to capture. The example assumes <section id="capture">.

2. Set dimensions deliberately

The library’s default scale is the browser’s window.devicePixelRatio. Set it explicitly when you need predictable output. A scale of 2 makes a 600 CSS-pixel-wide element approximately 1,200 pixels wide, subject to layout and browser limits. It enlarges the raster grid; it cannot restore detail missing from source images.

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
Sale
Canon EOS Rebel T7 DSLR Camera EF-S 18-55mm f/3.5-5.6 is II Lens Kit
  • 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)

3. Encode and download a 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 capturing a page whose layout depends on viewport size:
  // windowWidth: element.scrollWidth,
  // windowHeight: element.scrollHeight
});

console.log(`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);

The quality argument is a number from 0 to 1 for lossy formats such as JPEG. Higher values generally preserve more detail while producing larger files. Pixel dimensions come from the canvas size and scale, not from this quality value. Prefer toBlob() for downloads. toDataURL() creates a large in-memory string and can cause performance or URL-length problems.

Verify the actual output type

Inspect the blob before saving if JPEG is mandatory. If a requested MIME type is unsupported or omitted, the Canvas API can fall back to PNG.

canvas.toBlob((blob) => {
  if (!blob) throw new Error("Encoding failed");
  console.log(blob.type, blob.size); // expect image/jpeg
}, "image/jpeg", 0.95);

Capture a rendered page with Playwright

Playwright’s Page screenshot API is the better fit when CSS effects, fonts, animations and browser layout must be represented as the browser displays them. Install Playwright in your project, install its browser binaries, and run this Node.js script:

import { chromium } from "playwright";

const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
await page.goto("https://example.com", { waitUntil: "networkidle" });
await page.screenshot({
  path: "page.jpg",
  type: "jpeg",
  quality: 90,
  fullPage: true,
  scale: "device"
});
await browser.close();

Playwright documents JPEG quality from 0 to 100 (default 80), fullPage capture and scale values of "css" or "device". Use scale: "css" for one output pixel per CSS pixel, or "device" to reflect the device pixel ratio. Choose the viewport in the browser context because it determines responsive layout and therefore the resulting image.

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.
Rank #2
Sale
8K Digital Camera, 88MP WiFi Cameras for Photography with 3.2" Touchscreen
  • 【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.

Capture one element instead of the entire page

const card = page.locator("#capture");
await card.screenshot({
  path: "card.jpg",
  type: "jpeg",
  quality: 95,
  scale: "device"
});

Wait for the content that affects the image before taking the shot. For lazy-loaded images, scroll or wait for the image’s load state; for animations, disable or pause them with an injected style when deterministic output is required.

Resolution, quality and fidelity are different

  • Pixel dimensions: CSS width and height multiplied by capture scale determine how many pixels are written.
  • JPEG quality: Controls lossy encoding and file size after rasterization. It does not add detail.
  • Source detail: A low-resolution, stretched source image remains soft at any scale.
  • Rendering fidelity: html2canvas supports only the CSS and content it implements; Playwright captures the browser’s rendered result.

Inspect the exported file’s dimensions rather than judging quality from its file size. A large JPG can still look blurry if the source image is small or the canvas was rendered at a low scale.

Handle cross-origin images and iframes

Images loaded from another origin need suitable CORS permission or a proxy arrangement. Otherwise the browser can mark the canvas as tainted, preventing pixel reads and export. html2canvas cannot bypass these browser security rules. Cross-origin iframes are likewise inaccessible to the library under normal browser restrictions. If you control the image server, configure an appropriate Access-Control-Allow-Origin policy and load images in a way compatible with that policy. For third-party pages you do not control, use browser automation or a server-side capture service rather than assuming a client canvas can read them.

Full-page captures and browser limits

Canvas area limits vary by browser, operating system and device; there is no universal maximum. Very tall pages can produce blank, clipped or failed canvases. For html2canvas, set windowWidth and windowHeight to the relevant element’s scroll dimensions when the layout requires it, and test in the browser where users will run the capture. Split extremely large documents into sections or use Playwright’s full-page screenshot path, then verify the resulting file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Kodak PIXPRO FZ55-BK 16MP CMOS Sensor Camera 5X Optical Zoom 28mm Wide
  • 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

Common failures and fixes

JPG is soft despite a high quality value

Check canvas.width and canvas.height, increase the capture scale, and inspect the intrinsic dimensions of source images. JPEG quality cannot create pixels.

Styles or effects do not match

Compare the page’s CSS with html2canvas’s supported-features documentation. Unsupported CSS, filters, fonts or complex compositing can differ. Switch to Playwright for the browser-rendered result.

Images are missing or export throws a security error

Resolve CORS for each image or use a permitted proxy. Cross-origin frames cannot be read by html2canvas.

The result is blank or clipped

Reduce the capture area, set the correct window dimensions, wait for layout and images, and test for browser canvas limits. For very large pages, capture with Playwright or divide the page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Kodak PIXPRO FZ45 Digital Camera, 16MP Point & Shoot (Black)
  • 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 file is PNG instead of JPG

Pass "image/jpeg" explicitly, inspect blob.type, and confirm that the browser supports the requested encoder.

Fonts or lazy content are absent

Wait until fonts and images have loaded. In Playwright, navigate with an appropriate wait condition and explicitly wait for key selectors; in html2canvas, trigger lazy loading before rendering.

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 website screenshot API and MCP server. Its capture pipeline accepts cookie and consent banners, removes more than 60 known consent platforms plus newsletter popups and chat widgets, and lets you turn each cleanup step off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed; response headers identify the page verdict and whether the request was billed.

One GET request returns PNG, JPEG, WebP or PDF. This cURL example requests a screenshot of the target URL (adapt the URL as needed):

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the complete option list and parameter details in the ScreenshotNeo documentation. The same request in Python is:

Best Value
8K Digital Camera for Photography with WiFi 96MP Autofocus Vlogging Camera for YouTube Video 3.5'' 180°Flip Screen 20X Zoom Anti-Shake Compact Point and Shoot Cameras for Beginner Creator with SD Card
  • 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.
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)

And in 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}`);

ScreenshotNeo also supports full-page capture with lazy images, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, custom CSS and JavaScript, click and wait actions, hidden selectors, blocked ads/trackers/resources, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.

The Free plan includes 1,000 shots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan, and yearly billing provides two months free. Create a free ScreenshotNeo account to try it.

Operational and cost considerations

  • Client-side html2canvas uses the visitor’s CPU and memory and cannot read protected cross-origin pixels.
  • Playwright adds browser startup and maintenance overhead but gives a controlled rendering environment.
  • For repeated URLs, caching and asynchronous jobs can reduce duplicate work; validate cache behavior against your freshness requirements.
  • Record output dimensions, MIME type and errors in automated jobs so a successful HTTP response is not mistaken for a valid image.
  • Test with the browser, fonts, viewport and source assets used in deployment; rendering options can change with library and browser versions.

FAQ

Can I make a JPG sharper by setting quality to 100?

No. Quality changes JPEG compression. Increase rendered pixels and use higher-resolution source assets for more detail.

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

Should I use PNG instead?

PNG avoids JPEG’s lossy artifacts and is often preferable for text-heavy graphics, but it can be larger. Use JPG when its smaller files and photographic compression suit the result.

Does html2canvas capture content inside a cross-origin iframe?

Not under normal browser security restrictions. The frame must be same-origin or captured separately by a tool that controls the page.

Is a device-pixel-ratio capture always better?

It produces more pixels on high-density displays, but increases memory and file size. Choose the scale that matches the delivery size and test large pages.

Quick Recap

SaleBestseller No. 1
Canon EOS Rebel T7 DSLR Camera EF-S 18-55mm f/3.5-5.6 is II Lens Kit
Canon EOS Rebel T7 DSLR Camera EF-S 18-55mm f/3.5-5.6 is II Lens Kit
24.1 Megapixel CMOS (APS-C) sensor with is 100–6400 (H: 12800); Built-in Wi-Fi and NFC technology
$499.00
SaleBestseller No. 3
Kodak PIXPRO FZ55-BK 16MP CMOS Sensor Camera 5X Optical Zoom 28mm Wide
Kodak PIXPRO FZ55-BK 16MP CMOS Sensor Camera 5X Optical Zoom 28mm Wide
16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting; Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
$139.99
SaleBestseller No. 4
Kodak PIXPRO FZ45 Digital Camera, 16MP Point & Shoot (Black)
Kodak PIXPRO FZ45 Digital Camera, 16MP Point & Shoot (Black)
16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting; Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
$99.99

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.