io#

I/O functions for loading and saving images, textures.

load_cube_map_texture(fnames, *[, size, ...])

Load a cube map texture from a list of images.

load_image_texture(fname, *[, size, ...])

Load an image texture from a file or URL.

load_image(filename)

Load an image from a file or URL.

load_image_as_wgpu_texture_view(filename, device)

Load an image from a file or URL as a wgpu Texture view.

save_image(arr, filename, *[, ...])

Save a 2D or 3D image to a file.

load_cube_map_texture#

fury.io.load_cube_map_texture(fnames, *, size=None, generate_mipmaps=True)[source]#

Load a cube map texture from a list of images.

Parameters:
  • fnames (list) – Filenames to generate cube map.

  • size (tuple, optional) – The display extent (width, height, depth) of the cubemap.

  • generate_mipmaps (bool, optional) – Whether to automatically generate mipmaps when transferring data to the GPU.

Returns:

PyGfx Texture object.

Return type:

Texture

load_image_texture#

fury.io.load_image_texture(fname, *, size=None, generate_mipmaps=True)[source]#

Load an image texture from a file or URL.

Parameters:
  • fname (str) – Path to image file or URL. Should be png, bmp, jpeg or jpg files.

  • size (tuple, optional) – The display extent (width, height) of the texture.

  • generate_mipmaps (bool, optional) – Whether to automatically generate mipmaps when transferring data to the GPU.

Returns:

PyGfx Texture object.

Return type:

Texture

load_image#

fury.io.load_image(filename)[source]#

Load an image from a file or URL.

Parameters:

filename (str) – Path to image file or URL. Should be png, bmp, jpeg or jpg files.

Returns:

Loaded image array.

Return type:

ndarray

load_image_as_wgpu_texture_view#

fury.io.load_image_as_wgpu_texture_view(filename, device)[source]#

Load an image from a file or URL as a wgpu Texture view.

Parameters:
  • filename (str) – Path to image file or URL. Should be png, bmp, jpeg or jpg files.

  • device (wgpu.GPUDevice) – The wgpu device to create the texture on.

Returns:

Loaded image as wgpu Texture view.

Return type:

wgpu.GPUTextureView

save_image#

fury.io.save_image(arr, filename, *, compression_quality=75, compression_type='deflation', dpi=(72, 72))[source]#

Save a 2D or 3D image to a file.

Parameters:
  • arr (ndarray) – Array to save with shape (H, W) or (H, W, 1) or (H, W, 3) or (H, W, 4).

  • filename (str) – Output filename. Should be png, bmp, jpeg, jpg, tiff, or tif file.

  • compression_quality (int, optional) – Compression quality for jpeg data. 0 = Low quality, 100 = High quality.

  • compression_type (str, optional) – Compression type for tiff file. Select between: None, lzw, deflation (default).

  • dpi (float or tuple of float, optional) – Dots per inch (dpi) for saved image. Single values are applied as dpi for both dimensions.