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.2.0.tar.gz (15.5 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.2.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: infographics_builder-2.2.0.tar.gz
  • Upload date:
  • Size: 15.5 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.2.0.tar.gz
Algorithm Hash digest
SHA256 f835d747adde29a20fc02cc907439bf7a5f9e103de3a8582163bf5d3553a9bcf
MD5 49cc62627ce83629775862cda7d8ebdb
BLAKE2b-256 f0667d4d9a6eb2ccd9fd73fae52d7161fadba4d0f69d206b87dc793987d957e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for infographics_builder-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b8c5ee4d6cd94810502a55ef5318cfc2d3a3ff5790f149a2e4546e2020b6fb5f
MD5 4c748f16f714be6ba0c27ac4ba4f3fcb
BLAKE2b-256 8df9575208c84ed864929cb1a73bad03a4fb4cf1538018dc9aa4300cda05ec08

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