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.1.0.tar.gz (14.1 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.1.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: infographics_builder-2.1.0.tar.gz
  • Upload date:
  • Size: 14.1 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.1.0.tar.gz
Algorithm Hash digest
SHA256 d8adbbc736c8758ed97b9a4e19fd54938cb0d60d938749d0459f185a3fe1964d
MD5 316acef8db7ef3e4234d114b22df10bb
BLAKE2b-256 2579742a478680d409c7f6b7c84e2d402da0b5cdeaecc8d2aae474c44adfc604

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for infographics_builder-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7697db04138b61b72a75be92047784712d7c5e55423ef3ac87954bfa8991acb
MD5 e39f1b1e722d2d99f599bcd62612294f
BLAKE2b-256 a750908fb144ac4cd62c553971acbe195387e50bc49ba4d9804049bf2a79ed8a

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