stillleben.ImageSaver class

Multi-threaded image writer.

Contents

Typical usage

import stillleben as sl

sl.init()

with sl.ImageSaver() as saver:
    saver.save(torch.zeros(640,480,3), '/tmp/test.png')

Methods

def save(self, image: at::Tensor, path: str) -> None
Save image.

Special methods

def __enter__(self, /) -> ImageSaver
def __exit__(self, arg0: object, arg1: object, arg2: object, /) -> None
def __init__(self, /) -> None
Constructor.

Method documentation

def stillleben.ImageSaver.save(self, image: at::Tensor, path: str) -> None

Save image.

Note: This call is asynchronous. You can only assume the image has been written once __exit__() has been called.

param image
Image tensor. Needs to have uint8 type and shape HxWx4 (RGBA), HxWx3 (RGB), or HxW (grayscale). Grayscale images can also be uint16.