0.0.6
New Features
Text Rendering Module
Added text rendering with professional typography control.
from pyimagecuda import Text, save
text_img = Text.create(
"Hello World",
font="Arial Bold",
size=48,
color=(1.0, 1.0, 1.0, 1.0),
bg_color=(0.0, 0.0, 0.0, 1.0)
)
save(text_img, 'output.png')Features:
- System font support with weight/style variations
- Pango markup for rich text (bold, italic, colors, superscript/subscript)
- Letter spacing and line spacing control
- Text alignment (left, center, right)
- Independent text and background colors
- Buffer reuse for batch processing
Rich text example:
text_img = Text.create(
'Normal <b>Bold</b> <i>Italic</i>\n'
'<span foreground="orange">Orange</span> and <sub>subscript</sub>',
size=40
)API
Text.create()
Text.create(
text: str,
font: str = "Sans",
size: float = 12.0,
color: tuple[float, float, float, float] = (0.0, 0.0, 0.0, 1.0),
bg_color: tuple[float, float, float, float] = (0.0, 0.0, 0.0, 0.0),
align: Literal['left', 'centre', 'right'] = 'left',
justify: bool = False,
spacing: int = 0,
letter_spacing: float = 0.0,
dst_buffer: Image | None = None,
u8_buffer: ImageU8 | None = None
) -> Image | NoneReturns new Image with rendered text (or None if dst_buffer provided).
Documentation
New page: Text Rendering Guide
Installation
pip install --upgrade pyimagecuda