hex_htmltoimg
Convert HTML to images with ease and flexibility! 🖼️✨
Overview
hex_htmltoimg is a powerful Python module that transforms HTML files into high-quality images with dynamic content replacement and customizable rendering.
🌟 Features
- HTML to Image Conversion: Seamlessly transform HTML content into crisp, professional images
- Dynamic Content Placeholders: Replace placeholders with personalized, real-time content
- Flexible Image Sizing: Customize output image dimensions effortlessly
- Unique Filename Generation: Automatically create distinct filenames for each generated image
- Image Resizing: Adjust image sizes post-generation with built-in tools
🚀 Installation
Install the module quickly using pip:
pip install hex_htmltoimg
💡 Usage Examples
Basic Usage
from hex_htmltoimg import generate_image_from_html
# Path to your HTML template
html_file_path = 'template.html'
# Dynamic content replacements
replacements = {
'{{title}}': 'Hello, World!',
'{{content}}': 'Dynamically generated image magic!'
}
# Generate image with custom dimensions
image_filename = generate_image_from_html(
html_file_path,
replacements,
width=800,
height=600
)
print(f"Image saved: {image_filename}")
HTML Template Example
<!DOCTYPE html>
<html>
<body>
<h1>{{header}}</h1>
<p>{{content}}</p>
<footer>{{footer}}</footer>
</body>
</html>
🔧 Parameters
| Parameter | Description | Default |
|---|---|---|
file_path |
Path to the HTML file | Required |
replacements |
Dictionary of placeholder replacements | {} |
width |
Output image width | 650px |
height |
Output image height | 1250px |
⚠️ Error Handling
The module handles various scenarios:
- Raises
FileNotFoundErrorif HTML file is missing - Validates width and height as positive integers
- Manages image generation exceptions
📄 License
MIT License - Free for personal and commercial use.
🤝 Contributing
Contributions are welcome!
- Fork the repository
- Submit issues
- Create pull requests
📞 Support
For more information, check the project repository.
Generated with ❤️ by azharbhat-dev
Metadata
Release files for hex-htmltoimg 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hex_htmltoimg-1.2.0.tar.gz | 3.6 kB | Without provenance | Details for hex_htmltoimg-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hex_htmltoimg-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for hex_htmltoimg-1.2.0-py3-none-any.whl |
Total release size: 7.4 kB
Release files / hex_htmltoimg-1.2.0.tar.gz
| Download URL | hex_htmltoimg-1.2.0.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8cc2d55d4294021054fb1caa4639cbb075029d0d5976cad210c72a2c521905d
|
|
BLAKE2b-256 checksum How to use checksums |
5f0f307020a29429cf9152e903316208f5c2a370db56823061a0302d2e5fa38b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.6
|
Release files / hex_htmltoimg-1.2.0-py3-none-any.whl
| Download URL | hex_htmltoimg-1.2.0-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f5e457bc5ee1444c0b1e98ae2bb6006d9eaabfb98ab55dc758bdb18e2a381cb
|
|
BLAKE2b-256 checksum How to use checksums |
502e891e458c82d86346aacb884ad27856b161b50db88a2b52d62a8e8cfb900c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.6
|
Security for hex-htmltoimg 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.