--- id: pictex version: "2.3.0" license: unclear license_treatment: permissive maintenance: active --- # pictex — A Python library for efficient image generation using CSS Flexbox. License: permissive · Maintenance: active · Downloads: 84.2K/mo ## What it is and what it does PicTex is a Python library that generates images by composing layout elements (Row, Column, Text, Image) using CSS Flexbox principles. You describe your visual design using familiar web layout properties like justify-content, align-items, and flex-grow, then render the result as a raster or vector image. It handles typography through HarfBuzz (supporting kerning, ligatures, and complex scripts), bidirectional text, gradients, shadows, and rounded borders—all without needing a browser or headless rendering infrastructure. The library is built on industry-standard graphics engines: Skia for rendering, Taffy for layout computation, and HarfBuzz for text shaping. It's designed for automated image generation workflows like Open Graph previews, social media cards, video thumbnails, data visualizations, and report generation. If you know CSS, the API is intuitive; if you don't, the fluent method-chaining style makes styling declarative and readable. Use it for: - Generate Open Graph and social media preview images dynamically from metadata or API responses. - Create styled code snippet images for tutorials, documentation, or social sharing. - Build data visualization graphics (tables, charts) as PNG/SVG without a web rendering layer. - Automate profile cards, GitHub repository cards, or tweet-like social graphics from structured data. - Render multilingual or emoji-heavy text as images with proper shaping and bidirectional layout. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. PicTex generates high-quality PNG, JPEG, WebP, and SVG images programmatically using CSS Flexbox layouts, powered by Skia graphics rendering and HarfBuzz text shaping. Yes, if you need programmatic image generation with CSS-like layout control and don't want browser overhead. The library is actively maintained, has no known vulnerabilities, uses a permissive license, and supports modern Python versions. Install friction is low. The main caveat: skia-python and uharfbuzz are compiled dependencies; verify prebuilt wheels are available for your platform before committing to the stack. ## Install pip install pictex uv add pictex poetry add pictex ## Installing pictex Before you install: Low friction: pure Python wheel with no compiled system dependencies beyond the runtime stack (skia-python, uharfbuzz). Active maintenance with last commit 2026-04-03 and 210 repository stars. Supports Python 3.9 through 3.13. License in practice: MIT license (permissive): you can use, modify, and distribute PicTex freely in commercial and open-source projects with minimal restrictions. Quickstart: pip install pictex from pictex import Canvas, LinearGradient canvas = Canvas().font_size(60).color("white").background_color(LinearGradient(["#2C3E50", "#FD746C"])) image = canvas.render("Hello, World!") image.save("output.png") Requires Python 3.9 or later; skia-python and uharfbuzz are compiled dependencies that may require build tools on some systems. Verify before relying: - Whether skia-python and uharfbuzz prebuilt wheels are available for all major platforms (Windows, macOS, Linux) without requiring compilation. - Performance characteristics and memory footprint when rendering large or complex layouts. - Exact SVG export capabilities and whether font embedding works reliably across all font types. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 84.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags css flexbox image generation, programmatic graphic design python, text to image rendering, social media card generator, layout-based image creation, image-generation, layout-engine, typography [View on SkillFed](https://skillfed.io/packages/pictex) · [View on PyPI](https://pypi.org/project/pictex/)