QuickLook

The QuickLook service draws file thumbnails as the Finder does. Access it via app.quicklook.

nib.Image(src=app.quicklook.thumbnail("~/Documents/report.pdf", size=128))

Methods

thumbnail(path, size=256, icon_allowed=True, timeout=30.0)

The thumbnail of a file as PNG bytes.

Parameter Type Description
path str \| PathLike Any file the system can preview: images, PDFs, documents, videos, fonts...
size float The longest side in points; the PNG is drawn at the screen scale
icon_allowed bool When the file has no preview, return its icon. With False such a file raises nib.ServiceError
timeout float Seconds to wait; a large video can take a moment