Imaging and Composition API Reference
purrint.imaging.ImageOptions
dataclass
How to turn a picture into dots.
rotate:"auto"turns landscape pictures 90° so they use the length of the paper; or an angle (0, 90, 180, 270) applied clockwise.dither:floyd(photos),atkinson(crisper photos),bayer(ordered pattern),halftone(newspaper dots),threshold(text/line art),none(grayscale printers only).brightness/contrast: -100..100.gamma: >1 darkens mid-tones, <1 lightens them.threshold: 0..255 cut-off used bythresholddithering.
Source code in src/purrint/imaging.py
purrint.imaging.prepare(source, width=384, options=ImageOptions(), gray=False)
Full pipeline. Returns mode "1" (dots) or, with gray=True, a 16-level mode "L" image.
Source code in src/purrint/imaging.py
purrint.imaging.preview(img, paper_margin=12)
An RGB picture of how the job looks on paper (useful for dry runs and UIs).
Source code in src/purrint/imaging.py
purrint.imaging.stack(images, gap=0)
Join images vertically (all must share the same width).
Source code in src/purrint/imaging.py
purrint.text.render_text(text, width=384, *, font=None, size=26, bold=False, mono=False, align='left', line_spacing=1.2, padding=4, invert=False, underline=False)
Lay out text across width dots and return a mode "1" image.
align is left, center or right. Long lines wrap on spaces; \n starts a new line.
Source code in src/purrint/text.py
purrint.text.render_qr(data, width=384, *, size=None, border=2, error_correction='M', caption=None, caption_size=22)
A centred QR code (requires pip install purrint[qr]). size is the QR side in dots.
Source code in src/purrint/text.py
purrint.text.render_separator(width=384, height=12, style='dashed')
A horizontal rule: solid, dashed or dotted.