create_output

tifffile.create_output(out, /, shape, dtype, *, mode='w+', suffix=None, fillvalue=0)

Return NumPy array where images of shape and dtype can be copied.

Parameters:
  • out (OutputType) –

    Specifies kind of array to return:

    None:

    A new array of shape and dtype is created and returned.

    numpy.ndarray:

    An existing, writable array compatible with dtype and shape. A view of the array is returned.

    ’memmap’ or ‘memmap:tempdir’:

    A memory-map to an array stored in a temporary binary file on disk is created and returned.

    str or open file:

    File name or file object used to create a memory-map to an array stored in a binary file on disk. The memory-mapped array is returned.

  • shape (Sequence[int]) – Shape of NumPy array to return.

  • dtype (DTypeLike) – Data type of NumPy array to return.

  • suffix (str | None) – Suffix of NamedTemporaryFile if out is ‘memmap’. The default suffix is ‘memmap’.

  • fillvalue (int | float | None) – Value to initialize newly created arrays. If None, return an uninitialized array.

  • mode (Literal['r+', 'w+', 'r', 'c'])

Return type:

NDArray[Any] | numpy.memmap[Any, Any]