Most “cropped background” problems have one of two causes: CSS is intentionally hiding part of the image (usually background-size: cover), or the exported canvas is smaller than the element you meant to capture. Compare the live element’s box with the output dimensions, inspect the computed background rules, then verify that the image loaded and that your browser can rasterize the SVG foreignObject used by dom-to-image. Change only the setting that matches the symptom.
First determine what is actually cropped
Open the page beside the exported PNG, JPEG or data URL. Ask whether the image is missing inside the element or whether the element itself ends too early.
- Internal crop: the exported element has the expected outer size, but the visible part of the background is different from the live page. This is normally controlled by
background-size,background-position, and the background box’s aspect ratio. - Outer-boundary crop: the screenshot stops at an edge before the target element ends. The selected node may be a smaller descendant, or the capture dimensions may be too small.
- Missing background: no background appears, or it appears inconsistently. Treat this as a loading, embedding, or browser-rasterization problem rather than a CSS crop until proven otherwise.
Use DevTools to inspect the exact node passed to domtoimage.toPng, toJpeg, toSvg, or another export method. In the Computed panel record its rendered width and height, then record the output bitmap’s pixel dimensions. A mismatch immediately narrows the diagnosis.
How dom-to-image produces the screenshot
dom-to-image does not take a camera-like snapshot of the browser surface. It clones the selected DOM node recursively, copies computed styles, recreates pseudo-elements, embeds web fonts and images (including images referenced by CSS backgrounds), serializes the clone into SVG containing foreignObject, and rasterizes that SVG through an off-screen canvas for raster formats.
#1 Best Overall
- 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
Each stage can create a different symptom:
- The CSS box determines which part of a
background-imageis visible. - The clone’s dimensions and the library’s requested
widthandheightdetermine the exported boundary. - An unavailable image or font can leave the clone visually incomplete.
- Browser support for SVG
foreignObjectand canvas limits can make output browser-specific.
The README documents width and height options that apply those dimensions to the node before rendering. They enlarge or constrain the rendered node; they do not rewrite background-size or reveal pixels that CSS placed outside the background box.
Fix an internal crop caused by CSS fitting
Inspect the computed background values
Run this in the console, replacing the selector with the node you capture:
const el = document.querySelector('.hero');
const s = getComputedStyle(el);
console.table({
width: s.width,
height: s.height,
backgroundImage: s.backgroundImage,
backgroundSize: s.backgroundSize,
backgroundPosition: s.backgroundPosition,
backgroundRepeat: s.backgroundRepeat,
backgroundOrigin: s.backgroundOrigin,
backgroundClip: s.backgroundClip
});
Check for a shorthand rule such as background: center/cover url(...); DevTools expands it into the longhand values shown above.
Understand what cover does
background-size: cover scales the source until the entire element is filled. If the image and element have different aspect ratios, one axis necessarily extends beyond the box and is clipped. That is expected CSS behavior, not a dom-to-image defect. To show the whole image, try contain (which may leave empty space), explicit dimensions, or an <img> with an appropriate object-fit value.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Rank #2
- 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
/* Entire source image visible; letterboxing is possible */
.card {
background-image: url('/images/card.jpg');
background-size: contain;
background-position: center;
background-repeat: no-repeat;
}
/* Fill the box and choose which area is sacrificed */
.hero {
background-size: cover;
background-position: 50% 20%;
}
Do not change cover merely because the export differs from the live page. If the live page intentionally uses a crop, the correct export should preserve it. Change the fitting or position only when the desired result is a different region or the complete source image.
Check the element’s own geometry
Backgrounds are painted relative to the element’s background positioning area. Padding, borders, box-sizing, transforms, and responsive layout can alter the box you think you are capturing. Log the actual rectangle:
const r = document.querySelector('.hero').getBoundingClientRect();
console.log({left: r.left, top: r.top, width: r.width, height: r.height});
Capture the node whose rectangle contains the intended background, not a wrapper with a smaller fixed height or a child that clips overflow. If a parent has overflow: hidden, determine whether that clipping is part of the design or the reason the image cannot be seen.
Fix an export whose outer edge is cut off
Select the intended node
Pass the same element you inspected to the library. A common mistake is selecting a card’s content child while expecting the card’s background, or measuring a responsive container before fonts and images finish changing its size.
Windows 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 reinstallCrashes, 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 minuteRank #3
- 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.
const node = document.querySelector('.hero');
// Verify this is the node that owns the background.
console.log(node, node.getBoundingClientRect());
domtoimage.toPng(node, {
width: Math.ceil(node.getBoundingClientRect().width),
height: Math.ceil(node.getBoundingClientRect().height)
}).then(dataUrl => {
const a = document.createElement('a');
a.href = dataUrl;
a.download = 'hero.png';
a.click();
});
Use integer dimensions to avoid fractional-pixel rounding. Set only the dimension that is wrong when possible; forcing both can change the layout and therefore the background crop.
Wait for layout and assets before exporting
Call the export after the target is visible, fonts have loaded, and the background request has completed. A simple image preload check is:
async function waitForBackground(el) {
const value = getComputedStyle(el).backgroundImage;
const match = value.match(/url(["']?(.*?)["']?)/);
if (!match) return;
const img = new Image();
img.src = match[1];
await img.decode();
}
const node = document.querySelector('.hero');
await document.fonts.ready;
await waitForBackground(node);
const png = await domtoimage.toPng(node);
This helper covers a single simple URL. Multiple backgrounds, gradients, data URLs, and CSS rules that resolve through variables need corresponding checks. The important point is to export after the browser has the same resources that the user sees.
When the background is absent: loading and embedding checks
The library documents embedding images used in CSS backgrounds. That does not guarantee every URL is fetchable in your page. Verify the URL in the Network panel and look for 404 responses, redirects that require credentials, mixed-content blocking, or a response blocked by a content-security policy. A background that never loaded cannot be reproduced by the clone.
Rank #4
- 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
- Use an absolute or correctly resolved URL and confirm it returns an image with a successful status.
- If the image is protected, make sure the page is allowed to request it; do not assume the exporter can bypass authentication.
- For cross-origin assets, investigate the browser’s canvas security rules and the way your page serves the resource. A resource that displays in CSS can still cause rasterization restrictions.
- Test with a small same-origin image. If that works, reintroduce the original URL to isolate the resource issue.
Inspect the generated SVG when possible. If its serialized styles contain the expected background declaration but the image data is missing, focus on fetching and embedding. If the SVG contains the image and the raster output is still wrong, focus on browser support or canvas limits.
Browser and package differences
The output path relies on SVG foreignObject. The project README includes historical browser-support caveats; treat those notes as documentation of the project’s era, not as a current guarantee for every browser release. Reproduce the problem in another supported environment and compare the SVG output before blaming CSS.
Confirm the package name and version in your lockfile. dom-to-image-more is a related fork with its own documentation covering CSS image handling, sizing, canvas limits, and additional behavior. Options documented only for that fork must not be assumed to exist in the original dom-to-image. If a suggested setting is ignored, first verify which package is installed.
Symptom-to-fix decision table
| Symptom | First check | Likely adjustment |
|---|---|---|
| The image is present, but the visible region inside the element is wrong | Computed background-size and background-position |
Change CSS fitting or positioning only if you want another region or the entire source |
| The whole element is cut off at its outer edge | Target node and output width/height |
Select the correct node and provide suitable dimensions |
| The background is missing or intermittent | Network request, embedding, then browser rasterization | Resolve loading or isolate a browser-specific rendering failure |
| An option from a forum post has no effect | Exact package and version | Check whether the advice belongs to dom-to-image-more rather than the original library |
Performance, reliability, and size limits
- Keep the capture box deliberate. A full-page or very large node consumes more memory during SVG serialization and canvas rasterization. Capture the smallest node that contains the required background.
- Use explicit dimensions for reproducibility. Responsive widths, late font swaps, and animations can change the box between runs. Freeze the viewport, wait for layout, and round dimensions.
- Disable motion while diagnosing. Pause transitions and animations so the clone is not created between two background positions.
- Test the final format. PNG preserves transparency; JPEG does not. A transparent or clipped-looking result can be a format choice rather than a crop.
- Watch browser canvas limits. Extremely wide or tall captures may fail or be downscaled. Reduce the node, split a long page, or use a capture service that documents its own limits.
There is no single documented setting that fixes every cropped-background report. A controlled comparison—same node, same computed styles, same dimensions, then one changed variable at a time—is faster than changing several CSS rules together.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- 【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.
Or skip the browser setup
If you only need a reliable image or PDF of a URL rather than a DOM debugging session, ScreenshotNeo provides a website screenshot API. One GET request returns PNG, JPEG, WebP, or PDF. Before capture it accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and whether the request was billed. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
Use the API documentation at screenshotneo.com/docs/ for all 63 options, including full-page lazy-image loading, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF paper and page controls, custom CSS or JavaScript, click and wait conditions, blocking ads or resource types, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Common parameter names used by other screenshot APIs are accepted to ease migration.
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)
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}`);
ScreenshotNeo includes every feature on every plan. The Free plan allows 1,000 shots each month without a card; paid plans start at $5 for 3,000 shots, with yearly billing providing two months free. Create a free ScreenshotNeo account to try the 1,000-shot allowance.
FAQ
Does background-size: contain always solve the problem?
No. It can reveal the entire source image, but it may add empty space. If the outer export is clipped, fix the target node or capture dimensions instead.
Why does the live page look correct while the export is blank?
The browser may display a resource that the clone cannot fetch or embed, or the rasterizing browser may handle foreignObject differently. Check the network response and generated SVG before changing CSS.
Can I use dom-to-image-more options with dom-to-image?
Only after confirming the installed package and version. The fork has separate documentation and behavior.
Frequently Asked Questions
Will increasing only the width option reveal a background hidden by cover?
No. Width and height change the rendered node dimensions; CSS fitting still determines which part of the source is painted inside that box.
What should I compare when debugging a report from another browser?
Compare the serialized SVG, computed styles, loaded resource responses, and canvas output for the same node and dimensions. This separates CSS geometry from browser rasterization.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →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.

