To convert HTML code to an image without adding an online converter’s branding, render the markup in a browser and save a screenshot. Playwright can load an HTML string, capture a viewport, a full page, or one element, and save PNG, JPEG, or WebP. A local screenshot does not add a converter’s watermark layer; visible branding that is part of your own HTML will remain.
Choose what the image should contain
HTML is instructions for laying out a page, not an image. A browser must render those instructions into pixels before you can save them as a raster file. The right capture depends on the composition you want:
- Viewport: captures the browser’s visible canvas at the dimensions you set. Use it for a design intended to fit a fixed-size image.
- Full page: captures content below the visible fold as well. Use it for a long page or complete mockup.
- One element: isolates a component such as a card, banner, or button. Use this when you do not want surrounding page content.
Playwright documents page and element screenshots and full-page capture in its screenshot guide. The API also supports setting page content and screenshot output options in the Page API.
Convert an HTML string to an image with Playwright
This Node.js example loads HTML directly, sets a deliberate viewport, waits for fonts, and writes a PNG. Save it as html-to-image.cjs. It assumes Node.js is installed and that the HTML does not depend on external assets that need additional setup.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- User-Friendly Portable Photo Printer for iPhone, Android & PC - Get beautiful and colourful memories with Liene 4x6 photo printer! After opening the entire package, you can find one cartridge + 20 sheets of photo paper (placed inside the machine packaging), as well as an additional box containing 80 sheets of photo paper (which includes two cartridges + 80 sheets of photo paper). Full package includes smartphone photo printer, Liene 4x6 photo printer papers (100 sheets), 3 colour cartridges, and fully sealed cassette to prevent dust. Minimalist and magnetic design for compact storage.
- Superior Quality 4x6 Photo Printer - Print photos like no other thanks to the thermal-dye sublimation tech adopted by the picture printer for iphone. The dyes deeply penetrate the paper for vibrant photo printing, and the laminated surface is resistant to water, scratches, fingerprints and fading. Clean the print head promptly if smudges are observed on printed photos during operation. Get Liene photo printers now for yourself and your loved ones, print your happy moments together and keep your love forever!
- Wi-Fi Photo Printer for Smartphone - The built-in hotspot of the photo printer makes it easy to print pictures from your phone, avoiding outside interference with a fast and stable connection. No other networks required! Simply connect your device to the independent instant photo printer 4x6 hotspot.
- Multiple Device Compatibility - Liene phone printer provides instant photo printing for up to 5 simultaneous connections. Share with family and friends or print from your different devices. No additional cables or Bluetooth required when printing photos with this picture printer. Note: Ensure the ink cartridge clicks into place before printing.
- Customize your Printing with the Liene App - Customize your photos with our specialized App! You can add a Square border, insert filters, enhance the contrast and brightness, check printing status, and more. You can even print your ID and Visa photos from home with this photo printer for iphone 4x6 prints.
- Install Playwright and its Chromium browser:
npm init -y
npm install playwright
npx playwright install chromium
- Put your markup in the
htmlstring and save the following script:
const { chromium } = require('playwright');
(async () => {
const html = `
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
* { box-sizing: border-box; }
body {
margin: 0;
padding: 32px;
font: 16px/1.5 system-ui, sans-serif;
background: #f2f5f9;
color: #182230;
}
.card {
width: 520px;
padding: 28px;
border-radius: 16px;
background: white;
box-shadow: 0 8px 28px #1822301a;
}
h1 { margin: 0 0 12px; font-size: 28px; }
</style>
</head>
<body>
<main class="card">
<h1>A clean HTML-to-image capture</h1>
<p>The browser renders this markup; Playwright saves the pixels.</p>
</main>
</body>
</html>`;
const browser = await chromium.launch({ headless: true });
try {
const page = await browser.newPage({
viewport: { width: 640, height: 360 },
deviceScaleFactor: 1
});
await page.setContent(html, { waitUntil: 'load' });
await page.evaluate(() => document.fonts.ready);
await page.screenshot({ path: 'output.png' });
} finally {
await browser.close();
}
})().catch(error => {
console.error(error);
process.exitCode = 1;
});
- Run
node html-to-image.cjs. The PNG will be written tooutput.pngin the current directory.
The example sets a 640-by-360 CSS-pixel viewport, but the captured content can overflow it. For a complete long page, use fullPage: true in the screenshot options. For an element, locate it and call its screenshot method:
await page.locator('.card').screenshot({ path: 'card.png' });
If your markup lives in a file, read it into a string before page.setContent(html). If it is already hosted, navigate to its URL with page.goto(url) instead. For remote fonts, images, or app-generated content, wait for the specific asset or application state that matters before capturing; the load event alone cannot guarantee every dynamic page is visually ready.
Set capture size, format, and background
Dimensions and resolution
The viewport width and height are CSS pixels. deviceScaleFactor controls how many output pixels correspond to each CSS pixel: a factor of 1 generally follows CSS-pixel dimensions, while a higher factor produces a larger, higher-resolution raster. This also increases the output image’s pixel dimensions and typically its file size. Choose dimensions for the intended use rather than assuming a larger scale is always better.
PNG, JPEG, or WebP
Playwright’s documented default screenshot format is PNG. It also supports JPEG and WebP; use a matching file extension or set the format explicitly. JPEG and WebP support a quality setting for lossy compression; PNG does not use that setting. PNG is a practical choice for crisp interface text and transparency, while compressed formats can reduce file size where their quality trade-offs are acceptable.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsTransparent backgrounds
Use omitBackground: true to omit the default page background where the output format supports transparency. Playwright’s API documentation says this option does not apply to JPEG, which cannot preserve transparency. If you need a transparent result, use PNG or another format that supports it.
Rank #2
- Dock Photo Printer: The KODAK Dock Plus is a home photo printer that produces high-quality 4x6” prints directly from compatible smartphones. Featuring an integrated docking station, users can place their phone on the printer for better connection while simultaneously charging the device during printing.
- Genuine 4PASS dye sublimation printing: Each photo is produced in three color layers and finished with a clear protective lamination layer. In approximately 55 seconds, you receive a smooth, detailed print designed to resist fingerprints, water, and fading for long-lasting quality.
- Easy to Use: Print photos quickly without complicated setup or technical steps. Simply power on, connect wireless bluetooth, and start printing within seconds. The Dock Plus is built for straightforward operation, making it ideal for first time users and everyday photo printing.
- Home Printing Station: Designed for stable desktop use, this dock photo printer connects to a power outlet for consistent performance and larger 4x6” prints. Ideal for home printing, photo albums, framing, family events, and everyday picture printing.
- KODAK Photo Printer APP: Featuring integrated Bluetooth connectivity, this portable printer connects to compatible iOS and Android devices through the KODAK Photo Printer app. Edit, crop, and customize your photos before printing for creative results.
Returning image bytes instead of a file
If another part of your program will upload, process, or store the image, omit path from the screenshot call and keep the returned buffer:
const imageBytes = await page.screenshot({ type: 'png' });
// Pass imageBytes to your own upload or image-processing code.
Playwright documents screenshot buffers as well as saving screenshots to a path in its screenshot guide.
Capture a website instead of a markup string
When the HTML is hosted, navigate to its URL rather than passing a string to setContent. This lets the browser load the page’s normal stylesheets and resources, subject to access and readiness:
Recommended Free Tools
await page.goto('https://example.com/page', { waitUntil: 'load' });
await page.screenshot({ path: 'page.png', fullPage: true });
Use a URL you control or have permission to capture. Pages may vary by login, viewport, location, cookies, or time, and remote fonts, images, scripts, and data can fail or arrive after the initial load. For repeatable output, provide needed assets locally or wait on meaningful page-specific readiness conditions before taking the screenshot.
When to use another route
Playwright is a flexible choice for supplying raw HTML or visiting a URL, controlling capture scope, and choosing output settings. Puppeteer is another browser-automation option; its documentation covers Page.screenshot() and ElementHandle.screenshot() in the Puppeteer screenshot guide. PHP projects may consider Browsershot, a package that wraps Puppeteer and describes rendering URLs or arbitrary HTML to image or PDF; check its current installation requirements and release documentation in the Spatie Browsershot repository.
Rank #3
- 2x3" Portable Photo Printer: The upgraded PP01 photo printer uses advanced inkjet technology. This portable photo printer produces vivid, full-color prints on premium sticky-backed photo paper that is smudge-proof, water-resistant, and tear-resistant. The Nelko mini photo printer is pocket-sized and weighs only 308g, making it ultra-portable for school, travel, and field trips. Each ink cartridge prints up to 80 full-color 2x3 photos on sticky-backed paper
- Easy Printing via Bluetooth: The PP01 mini photo printer is compatible with iOS and Android phones via Bluetooth. Simply download the Nelko app from Google Play or the App Store. Load the 2x3 photo paper with the smooth side facing down. Install the ink cartridge, connect via Bluetooth, and print directly using the Nelko app. A USB charging cable is included; the adapter is not included
- High Photo Quality: This mini photo printer uses advanced inkjet technology for clear, vibrant prints. This portable photo printer produces 600 DPI high-resolution images with precise colors, capturing fine details and realistic tones. Each photo comes with adhesive backing, perfect for scrapbooks and preserving your memories. Personalize every photo for holidays, birthdays, or daily events
- Powerful App: The Nelko 2x3" PP01 photo printer app lets you edit photos and offers a variety of frame designs, making it perfect for personalizing your photos for projects like scrapbooking or journaling. Download the Nelko app to create collages and customize photos with filters, graffiti, borders, stickers, text, AI image editing, and many other features. Edit photos on your phone, then send them to the Nelko app for instant printing in under 90 seconds
- Versatile Usage Scenarios: This portable photo printer is ideal for travel journals, party favors, and family gatherings. Students use it for planners and photo printing. Crafters use it for DIY projects, custom labels, and scrapbooking. It's a practical tool for bloggers, small businesses, and event photographers to create instant giveaways. Perfect for Mother's Day surprises and heartfelt moments with loved ones using Nelko sticky-backed photo paper.
A hosted screenshot API can avoid managing a local browser for repeated or automated captures. Do not assume every hosted service is watermark-free, or that every free converter adds a watermark: verify the provider’s current policy, supported inputs, privacy terms, limits, and price before relying on it. The HTML to Image reference describes programmatic generation, but does not establish current pricing or watermark terms.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. One GET request can return a PNG, JPEG, WebP, or PDF. For a URL-based capture, use this cURL command (replace the example target URL and supply your API key):
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 reinstallcurl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for request options and setup. ScreenshotNeo accepts cookie or consent banners and removes 60-plus known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses identify page verdict and billing status in headers.
It also offers an MCP server for Claude, Cursor, and other MCP clients, with take_screenshot, get_page_info, and capture_pdf tools. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is available on every plan.
Sign up free for 1,000 screenshots a month—no card required.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshooting a wrong or incomplete image
Text or images are missing
Check that referenced files can be reached from the page’s URL or file location. A relative path that worked in your editor may resolve differently when HTML is supplied as a string. Wait for important remote assets to load, and inspect browser errors if an image or font request fails.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Rank #4
- Dual 4x6" & 3x3" Photo Printer Paper Tray Convenience: Seamlessly print both 6-inch standard photo paper and 3-inch sticky-backed paper with our innovative dual tray design. This compact phone photo printer for smartphone offers easy storage and quick access, making it perfect for diverse printing needs without taking up much space. Enjoy vibrant, high-quality prints every time.
- Fast Bluetooth Connectivity: Experience lightning-fast printing with our liene photo printer's Bluetooth connection, which pairs in just 13 seconds. Enjoy a seamless and efficient printing experience, perfect for capturing and sharing memories on the go without the hassle of cables or complex setups.
- Superior Quality Photo Printer 4x6 - Print photos like no other thanks to the thermal-dye sublimation tech adopted by the picture printer for iphone. The dyes deeply penetrate the paper for vibrant photo printing, and the laminated surface is resistant to water, scratches, fingerprints and fading. Get Liene photo printers now as amazing gifts for yourself and your loved ones, print your happy moments together and keep your love forever!
- Multiple Device Compatibility - Liene picture printer for iphone provides instant photo printing for up to mutiple simultaneous connections. Share with family and friends or print from your different devices. No additional cables required when printing photos with this phone printer.
- Customize your Printing with the Liene App - Customize your photos with our specialized App! You can add a Polaroid border, insert filters, enhance the contrast and brightness, check printing status, and more. You can even print your ID and Visa photos from home with this iphone photo printer for 4x6 & 3x3 prints.
The page is cut off
A normal page screenshot captures the viewport. Use fullPage: true for the complete scrollable document, or increase the viewport dimensions when the intended composition is a fixed canvas. To isolate a component, capture its locator rather than expanding the entire page.
The screenshot looks blurry or too large
Set the viewport to the intended CSS dimensions and choose a deliberate deviceScaleFactor. A higher scale creates more output pixels; it does not change the CSS layout width. If the image is too large for sharing, consider JPEG or WebP compression with an appropriate quality setting.
Transparency is missing
Use a format that supports transparency, such as PNG, and set omitBackground: true. JPEG will not preserve a transparent background.
The render differs from the browser preview
Match the viewport, device scale, color scheme, and available fonts to the target environment. Dynamic data, animation, consent dialogs, and delayed scripts may also change what appears. Wait for the relevant state or disable animation in your page’s own styles if a stable capture is required.
Browser installation or launch fails
Ensure Playwright and its browser binary are installed for the same project, and run npx playwright install chromium after installing the package. In restricted environments, browser dependencies or sandbox policies may prevent local launch; use an environment that permits headless Chromium or a hosted capture route.
Best Value
- Instant Photo Printing: The KODAK Mini 2 Retro is a portable photo printer designed to turn smartphone pictures into high quality prints in seconds. Whether capturing family moments, travel highlights, journaling pages, or creative projects, this mini printer lets you print real photos anytime, anywhere.
- Genuine 4PASS dye sublimation printing: Each photo is produced in three color layers and finished with a clear protective lamination layer. In approximately 55 seconds, you receive a smooth, detailed print designed to resist fingerprints, water, and fading for long-lasting quality.
- Easy to Use: Print photos quickly without complicated setup or technical steps. Simply power on, connect wireless bluetooth, and start printing within seconds. The Mini 2 Retro is built for straightforward operation, making it ideal for first time users and everyday photo printing.
- Print Anytime, Anywhere: Small enough to fit in your hand, bag, or even a pocket, the Mini 2 Retro is built for on-the-go printing. Ideal for parties, trips, school projects, scrapbooks, and spontaneous moments where you want real prints without waiting.
- KODAK Photo Printer APP: Featuring integrated Bluetooth connectivity, this portable printer connects to compatible iOS and Android devices through the KODAK Photo Printer app. Edit, crop, and customize your photos before printing for creative results.
Cost, reliability, and watermark expectations
A local Playwright workflow avoids relying on a converter’s branding policy and gives direct control over the browser capture. It does require a compatible runtime and browser installation, and your own page can still visibly include logos or text. For recurring jobs, account for browser startup, asset-loading delays, memory use for large full-page captures, and retries for genuinely transient navigation or resource failures. Keep waits specific to the page rather than using arbitrary long sleeps wherever possible.
Hosted services trade local setup for a provider’s terms and operational behavior. Compare whether raw HTML or only URLs are accepted, which capture scopes and image settings are available, how private input is handled, and what usage and billing rules apply. ScreenshotNeo’s plan prices are $5 for 3,000 shots on Starter, $15 for 15,000 on Growth, $39 for 60,000 on Pro, $99 for 250,000 on Scale, and $249 for 1,000,000 on Business; yearly billing gives two months free. Free provides 1,000 shots monthly with no card. Pricing and service terms can change, so check the linked product documentation before building a budget around a plan.
Frequently Asked Questions
Does converting HTML locally guarantee that the page itself has no branding?
No. The local screenshot workflow does not add a converter watermark, but any logo or branding already rendered by your HTML or website remains visible.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Can I convert a single HTML element rather than the whole page?
Yes. With Playwright, capture a locator such as page.locator('.card').screenshot({ path: 'card.png' }).
Can a screenshot contain a transparent background?
Yes, with a transparency-supporting format such as PNG and omitBackground: true; this option does not apply to JPEG.
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.

