Skip to main content

Zero-dependency HTML to Image converter

Project description

CoreImR

Advanced, Zero-dependency HTML to Image & PDF converter for Python.

It seamlessly opens a temporary HTML file natively using the headless browser engine (Chromium or Edge) already installed on your machine and takes a screenshot or prints a PDF. 100% zero-dependency, lightweight, lightning-fast, and feature-rich!

Full Stack Support

CoreImR natively utilizes the Chromium engine, meaning it fully supports all modern web technologies, development servers, and frameworks:

  • HTML5 & CSS3 (Canvas, SVG, Animations, Flexbox, Grid, Gradient, WebGL)
  • Frameworks & JSX (React, Next.js, Vue, Svelte) – Works perfectly with code built via npm or npx (just point CoreImR to your compiled HTML or local dev server!)
  • JavaScript & APIs (Fetch, WebSockets, dynamic DOM manipulation)
  • Backend Integration (PHP, Node.js, Python, Rust) – Generate dynamic templates on your backend and pass the output string directly to CoreImR to render receipts, invoices, or dynamic user cards!

Features (v1.1.1)

  • Zero Dependencies (only uses the Python standard library subprocess and OS built-in browsers)
  • Multi-Format Export (output_format='jpeg' | 'png' | 'bmp' | 'pdf') - natively generates PNGs and vector PDFs. Other formats convert seamlessly (install Pillow optionally for ultra-fast image conversions)
  • Configurable Dimensions (width, height)
  • Support for Transparent Backgrounds (transparent=True - perfectly cuts the background out!)
  • Delay / Virtual Time Budget (delay) - wait for animations/JS to load before capture
  • High DPI / Retina support (device_scale_factor) - scale up resolution cleanly for super-crisp text
  • Timeouts (timeout) - Safety mechanism to kill hung browser processes

Installation

pip install coreimr

Usage

Simple Example

from coreimr import render

render('<h1>Hello World!</h1>', 'output.png')

Advanced Example

from coreimr import CoreImR

html = """
<!DOCTYPE html>
<html>
<body style="background: transparent; margin: 0; width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center;">
    <h1 style="color: black; font-family: sans-serif;">Stable CoreImR with Transparent Background!</h1>
</body>
</html>
"""

# High DPI scaling, perfectly working transparency, and process safety timeouts!
imr = CoreImR(
    width=1920, 
    height=1080, 
    transparent=True, 
    delay=500,
    device_scale_factor=2, # Renders at 2x resolution (3840x2160) for crisp text
    output_format='png',   # You can also use 'pdf', 'jpeg', or 'bmp'!
    timeout=15             # Kills the process if rendering takes longer than 15s
)

imr.render(html, 'output_advanced_v1.1.1.png')

Publishing & Contributing

If you're developing locally:

  1. Build local wheels: python setup.py sdist bdist_wheel
  2. Publish to PyPI: twine upload dist/*

Enjoy building completely independent systems!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coreimr-1.1.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coreimr-1.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file coreimr-1.1.1.tar.gz.

File metadata

  • Download URL: coreimr-1.1.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for coreimr-1.1.1.tar.gz
Algorithm Hash digest
SHA256 cff7ca834fe751c769ffff7871bb3d0c66d3049eeae1b6a9af75cf11aa0500ee
MD5 2c7021ae66e35e53ca2db9d08c3c380b
BLAKE2b-256 cd55e9eebc3b2fab7277fb517e25fe21b3026ab4461c0aed709d76a050bfea3a

See more details on using hashes here.

File details

Details for the file coreimr-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: coreimr-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for coreimr-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c00e29bead7c0583b9f6c63a918a064289a3a861d944f57aee3d501dd817080e
MD5 95adab1c2c9823a60f6e9d59537ee9b1
BLAKE2b-256 07ac018c7d6b81d7b02066ee2238cf19056b8d2313f110aeee7a9de865883a52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page