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

To convert an HTML file to JPG, render it in a browser and save a screenshot in JPEG format. HTML is markup, not an image, so the conversion captures the page as it appears after the browser lays it out and loads its resources. For a one-off image, use a browser or HTML-to-image utility; for repeatable automation, Playwright offers an explicit JPEG screenshot option. Decide first whether you need the visible viewport or the entire page.

What “HTML to JPG” means

An HTML file contains structure and content instructions. A browser interprets those instructions, applies CSS, runs JavaScript, and loads images and other resources. The JPG is a capture of that rendered result, not a conversion of the markup text itself.

That distinction matters when choosing a method: the result depends on the browser viewport, the page’s loaded assets, and whether scripts have finished rendering. A static page may be ready immediately; a page with JavaScript or remote resources may need a wait before capture.

Choose the capture method

Need Suitable method Check before capture
One-time image Browser screenshot or an HTML-to-image command That the local file opens and the output is actually JPEG
Automated conversion in a project Playwright or Puppeteer JPEG support, viewport size, and whether you need full-page capture
Long page Playwright full-page capture or another tool with full-page behavior Final image height and whether the page layout works as one tall image
JavaScript-heavy content Browser automation or a renderer configured to run JavaScript That application rendering and dependent resources have completed
HTML with nearby images, stylesheets, or fonts Local-file rendering with the resource paths intact Relative paths and the renderer’s local-file access policy

Convert an HTML file to JPG with Playwright

Playwright documents JPEG as a screenshot format and supports both viewport and full-page captures. The following Node.js example opens a local HTML file and writes a JPEG. It assumes you have a Node.js project and Playwright installed; follow the official installation instructions for your environment, then save the script as html-to-jpg.js.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Liene M100 4x6'' Photo Printer, Phone Printer 100 Sheets & 3 Cartridges, Full-Color Photo, Portable Instant Photo Printer for iPhone Android, Thermal Dye Sublimation, Wi-Fi Picture Printer 100 Papers
  • 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.
const { chromium } = require('playwright');
const { pathToFileURL } = require('node:url');
const path = require('node:path');

(async () => {
  const browser = await chromium.launch();
  try {
    const page = await browser.newPage({
      viewport: { width: 1440, height: 900 },
      deviceScaleFactor: 1
    });

    const inputPath = path.resolve('page.html');
    await page.goto(pathToFileURL(inputPath).href, {
      waitUntil: 'load',
      timeout: 30000
    });

    // If the page renders content after load, replace this with
    // an appropriate waitForSelector() or other application-specific wait.
    await page.screenshot({
      path: 'page.jpg',
      type: 'jpeg',
      quality: 85,
      fullPage: true
    });
  } finally {
    await browser.close();
  }
})();

Place page.html beside the script, or change inputPath to its location. Run node html-to-jpg.js; the output is page.jpg. Playwright’s screenshot reference covers JPEG, filenames, viewport capture, and full-page capture: Playwright Screenshots & PDF. CLI flags and behavior can vary by installed Playwright version, so check that version’s help or documentation when using the CLI.

Viewport or full page?

With fullPage: true, the capture includes the full scrollable document. Omit that option or set it to false to capture just the visible viewport. A full-page JPG can become extremely tall; check the resulting dimensions and whether the page’s responsive layout is appropriate at the selected viewport width.

Wait for dynamic content

The example waits for the page’s load event. That is not proof that every application has finished rendering. If content appears after an API response, animation, or client-side initialization, wait for a specific element that signals readiness. For example, after navigation add await page.waitForSelector('.report-ready'); using a selector that actually exists in your page. A fixed delay can help with a known delay but is less reliable than waiting for a meaningful page condition.

Preserve local assets

Keep relative resource paths valid. For instance, if the HTML uses src="images/chart.png", keep the images folder in the expected location relative to the HTML file. If a stylesheet, font, or image fails to load, the screenshot may still be created but look incomplete. For local files that reference other local resources, confirm the renderer allows those files to load; security policies and path handling can affect access.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
KODAK Dock Plus 4x6 Photo Printer, Smartphone Docking, 4PASS, 50 Sheets
  • 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.

Use Puppeteer when it is already in your project

Puppeteer’s Page API demonstrates navigating to a page, saving a screenshot to a chosen path, and closing the browser. Adapt the navigation target to a local file URL as shown below. This pattern is useful if Puppeteer is already part of your automation, but the cited API example uses a PNG-named output path and does not by itself establish the exact JPEG options for every Puppeteer version. Consult the installed version’s screenshot options before relying on a JPG-specific setting.

const puppeteer = require('puppeteer');
const { pathToFileURL } = require('node:url');
const path = require('node:path');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.setViewport({ width: 1440, height: 900 });
    await page.goto(pathToFileURL(path.resolve('page.html')).href, {
      waitUntil: 'load'
    });
    await page.screenshot({ path: 'page.png' });
  } finally {
    await browser.close();
  }
})();

This example deliberately saves PNG rather than claiming an undocumented JPEG option. If a JPG is mandatory, use a JPEG-capable capture route such as Playwright’s documented JPEG option, or convert this PNG with a separate image-conversion tool. Puppeteer’s Page API: Puppeteer Page API.

Capture with Chrome Headless

Chrome Headless documents --headless, --screenshot, --window-size, and a timeout flag. Its screenshot example writes a PNG, so this command is appropriate when PNG is acceptable or as an intermediate step—not a direct promise of JPG output.

chrome --headless --screenshot=page.png --window-size=1440,900 file:///absolute/path/to/page.html

Use the executable name and file URL format appropriate to your operating system and Chrome installation. If the required deliverable is JPG, use a JPEG-capable capture method or convert the PNG separately. Chrome’s command-line reference: Chrome Headless command-line reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Nelko PP01 Photo Printer, 2x3 Portable Photo Printer, Mini Printer, White
  • 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.

Convert with wkhtmltoimage

wkhtmltoimage is a command-line HTML-to-image converter. Its invocation takes an input file and an output file, and its options include image quality, JavaScript behavior, JavaScript delay, image loading, screen width, and local-file access. A basic command is:

wkhtmltoimage --quality 85 --width 1440 page.html page.jpg

Check the installed command’s help or manpage for accepted output formats and option details. The Ubuntu Noble manpage describes package version 0.12.6-2build2; other packaged or installed versions may differ. For a file that depends on nearby assets, verify local-file access and resource paths rather than assuming they will load automatically. The manpage: wkhtmltoimage — HTML to image converter.

Image size, quality, and reliability

Set the viewport deliberately

The viewport determines responsive layout and the width of a viewport screenshot. Choose a width that matches how you want the page rendered, not merely the size of the monitor running the script. A narrow viewport may trigger a mobile layout; a wider one may show desktop navigation and different line wrapping.

Understand JPEG trade-offs

JPEG is a lossy format. In Playwright, the documented screenshot API accepts a quality setting for JPEG; the example uses 85 as a practical starting value, not a benchmark or universal optimum. Lower quality can reduce file size but introduce visible compression; higher quality generally preserves more detail at a larger size. Inspect the output at its intended viewing size, especially for small text, thin lines, and interface screenshots.

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 #4
Liene Amber M110 Bluetooth Photo Printer 80 Sheets, Portable Photo Printer for iPhone, Thermal Dye Sublimation, Picture Printer 60 Sheets 4x6 Paper & 20 Sheets 3" Square Sticker Paper & 2 Cartridges
  • 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.

Full-page dimensions can be large

Full-page capture is useful for archiving a long page, but it creates one tall raster image rather than a paginated document. Large dimensions can make the image slower to open, harder to share, and less convenient to print. If the goal is a printable multi-page document, PDF may be more appropriate than JPG.

Allow time for the page, not just the command

Capture reliability depends on loading the HTML and its dependencies and, for interactive pages, allowing scripts to finish. A navigation timeout can indicate a slow resource, a page that never reaches the requested load state, or an incorrect path. Prefer a page-specific readiness condition where possible; use a longer timeout only when the page genuinely needs more time.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

  • The output has a .jpg name but is not JPEG. An extension alone does not guarantee the file format. Set the capture type explicitly where supported, or use a conversion step; Chrome’s documented screenshot example produces PNG.
  • The image is blank or missing styles. Confirm the input file URL is correct, relative stylesheets and images exist, and local resources are permitted. Open the HTML in a browser to distinguish a document problem from a capture problem.
  • Text or images are missing even though the page opened. The screenshot may have been taken before asynchronous content was ready. Wait for a reliable selector or application-specific ready state, and check the browser console or network activity if resources are failing.
  • The image is cropped. A standard screenshot captures the viewport. Use full-page capture for the entire scrollable document, or increase the viewport dimensions if the visible area is too small.
  • The layout differs from what you see locally. Set the intended viewport width and device scale factor, and check whether the page uses responsive breakpoints, local fonts, or browser-specific styling.
  • A local image or stylesheet is blocked. Check its relative path and the renderer’s local-file permission settings. Avoid changing security settings broadly; allow access only as needed for trusted local content.
  • The command-line option is rejected. Options can differ across tool versions and distributions. Read the installed tool’s help or version-specific documentation; the Ubuntu Noble wkhtmltoimage manpage, for example, describes package version 0.12.6-2build2.
  • The output file is unexpectedly large or difficult to use. Reduce the capture dimensions or JPEG quality if visual inspection allows, capture only the viewport, or choose PDF when a long page should be paginated.

Or skip the browser setup

ScreenshotNeo can render a URL and return PNG, JPEG, WebP, or PDF from one GET request. To capture a local HTML file, make it available at a URL the service can reach; a local path on your computer is not itself a remotely accessible URL. For a web-accessible page, this cURL request saves a WebP capture:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

For JPG output, request the service’s JPEG format using the documented API parameter and value for your account and endpoint. The example above is intentionally reproduced with the supplied WebP output form rather than guessing an undocumented parameter. API details and supported options: ScreenshotNeo documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
KODAK Mini 2 Retro 2x3 Portable Photo Printer, 4PASS, 38 Sheets, White
  • 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.

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server provides screenshot tools for AI agents, and the free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. The browser-based workflows above are preferable when the HTML must remain local and inaccessible to an external service.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Can I convert an HTML file to JPG without installing a browser automation library?

Yes. A command-line HTML-to-image utility such as wkhtmltoimage can render an input file to an image, provided your installed version supports the requested output format.

Why does my JPG look different from the HTML in my editor?

The screenshot reflects browser rendering, including CSS, viewport-dependent layout, loaded assets, and script-generated content; an editor’s source view does not.

Should I use JPG or PDF for a long web page?

Use JPG when you need a raster image. If the goal is a paginated document for printing or reading, PDF may fit better.

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

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.