Skip to main content

CLI library for automated infographic poster generation: background removal, parallel headless rendering, color-based auto-patching and HTML asset validation.

Project description

infographics-builder

CLI Python library for automated generation of high-quality infographic posters.
Background removal • Parallel headless rendering • BFS color auto-patching • Asset validation


Features

Command Description
bg Remove background via rembg and center object on transparent canvas
render Render HTML template to print-quality JPG (2400×3600px) via headless Brave/Chrome
batch Parallel batch rendering of entire folder with progress bar and build log
patch Surgical rectangular texture patching via linear color interpolation
autopatch BFS-based automatic color region detection and patching (removes flags, labels)
validate Pre-render validation of all local image assets in HTML template

Installation

pip install infographics-builder

# Optional: progress bar support
pip install infographics-builder[progress]

Requirements:

  • Python 3.10+
  • Brave Browser or Google Chrome (for render / batch commands)

Quick Start

Remove background from image

infographics-builder bg input_photo.jpg output.png
infographics-builder bg input_photo.jpg output.png --size 1024 --padding 40

Render a single poster

infographics-builder render card.html poster.jpg
infographics-builder render card.html poster.jpg --browser "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe"

Batch render entire folder (with skip-existing and auto log)

infographics-builder batch ./html_pages/ ./renders/
infographics-builder batch ./html_pages/ ./renders/ --workers 4 --no-skip

Auto-patch unwanted color regions (flags, watermarks)

# Remove red (255,0,0) with tolerance 40
infographics-builder autopatch model.png 255 0 0 --tolerance 40

# Remove blue flag without creating a backup
infographics-builder autopatch model.png 0 0 200 --tolerance 30 --no-backup

Manual texture patch by coordinates

infographics-builder patch model.png 580 620 340 380
infographics-builder patch model.png 580 620 340 380 --no-backup

Validate HTML template assets

infographics-builder validate card.html

Python API

from infographics_builder import ImageProcessor, PosterRenderer, Validator

# Remove background
ImageProcessor.remove_background("photo.jpg", "output.png")

# Render poster
renderer = PosterRenderer()  # auto-detects Brave/Chrome
renderer.render("card.html", "poster.jpg")

# Batch render with progress bar
renderer.render_batch(
    html_paths=["card1.html", "card2.html"],
    output_jpg_paths=["poster1.jpg", "poster2.jpg"],
    skip_existing=True,   # skip already rendered
    log_dir="./logs/"     # write build_YYYY-MM-DD.log
)

# Auto-patch by color (BFS)
ImageProcessor.auto_patch_by_color("model.png", target_color_rgb=(255, 0, 0), tolerance=30)

# Validate assets
ok = Validator.validate_html("card.html")

Rendering Architecture

The render command uses a Chromium-based headless browser with these flags:

--window-size=1200,1800 --force-device-scale-factor=2

This produces a 2400×3600px screenshot (device-pixel-ratio 2x), which is then converted to JPG at 95% quality via Pillow.


Safety Features

  • Auto-backup (.bak): patch and autopatch create a .bak copy before modifying any file. Disable with --no-backup.
  • Skip existing: batch skips already-rendered JPGs by default (--no-skip to override).
  • Build log: Every batch run writes build_YYYY-MM-DD.log in the output directory.

License

MIT

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

infographics_builder-2.0.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

infographics_builder-2.0.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file infographics_builder-2.0.0.tar.gz.

File metadata

  • Download URL: infographics_builder-2.0.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for infographics_builder-2.0.0.tar.gz
Algorithm Hash digest
SHA256 13b3d3194148320e842ab915e3f114341d03f915de17af6eccb6edb69884d719
MD5 1f6e364687ba9576412881fdca076c57
BLAKE2b-256 8b680f5d208507f4321001a208d4f276d9c3e01b55dfbc80e1850506e9513ccb

See more details on using hashes here.

File details

Details for the file infographics_builder-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for infographics_builder-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da2916c4f5684ab575f69e5c421d4edfe6d51e488930d02d623aed3caac9f939
MD5 d3516fa78f7a85548d0e8c72cad4364b
BLAKE2b-256 115b1fea305e60f6e2bee668b6722e4c94184b877c33e372479719f009f9defa

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