imwrite¶
- tifffile.imwrite(file, /, data=None, *, mode=None, bigtiff=None, byteorder=None, imagej=False, ome=None, shaped=None, append=False, shape=None, dtype=None, photometric=None, planarconfig=None, extrasamples=None, volumetric=False, tile=None, rowsperstrip=None, bitspersample=None, compression=None, compressionargs=None, predictor=None, subsampling=None, jpegtables=None, iccprofile=None, colormap=None, description=None, datetime=None, resolution=None, resolutionunit=None, subfiletype=None, software=None, metadata={}, extratags=None, contiguous=False, truncate=False, align=None, maxworkers=None, buffersize=None, returnoffset=False)¶
Write NumPy array to TIFF file.
A BigTIFF file is written if the data size is larger than 4 GB less 32 MB for metadata, and bigtiff is not False, and imagej, truncate and compression are not enabled. Unless byteorder is specified, the TIFF file byte order is determined from the dtype of data or the dtype argument.
- Parameters:
file (str | os.PathLike[Any] | FileHandle | IO[bytes]) – Passed to
TiffWriter
.data (ArrayLike | Iterator[NDArray[Any] | None] | Iterator[bytes] | None) – Passed to
TiffWriter.write()
.shape (Sequence[int] | None) – Passed to
TiffWriter.write()
.dtype (DTypeLike | None) – Passed to
TiffWriter.write()
.mode (Literal['w', 'x', 'r+'] | None) – Passed to
TiffWriter
.append (bool) – Passed to
TiffWriter
.byteorder (ByteOrder | None) – Passed to
TiffWriter
.bigtiff (bool | None) – Passed to
TiffWriter
.imagej (bool) – Passed to
TiffWriter
.ome (bool | None) – Passed to
TiffWriter
.shaped (bool | None) – Passed to
TiffWriter
.photometric (PHOTOMETRIC | int | str | None) – Passed to
TiffWriter.write()
.planarconfig (PLANARCONFIG | int | str | None) – Passed to
TiffWriter.write()
.extrasamples (Sequence[EXTRASAMPLE | int | str] | None) – Passed to
TiffWriter.write()
.volumetric (bool) – Passed to
TiffWriter.write()
.tile (Sequence[int] | None) – Passed to
TiffWriter.write()
.rowsperstrip (int | None) – Passed to
TiffWriter.write()
.bitspersample (int | None) – Passed to
TiffWriter.write()
.compression (COMPRESSION | int | str | None) – Passed to
TiffWriter.write()
.compressionargs (dict[str, Any] | None) – Passed to
TiffWriter.write()
.predictor (PREDICTOR | int | str | bool | None) – Passed to
TiffWriter.write()
.subsampling (tuple[int, int] | None) – Passed to
TiffWriter.write()
.jpegtables (bytes | None) – Passed to
TiffWriter.write()
.iccprofile (bytes | None) – Passed to
TiffWriter.write()
.colormap (ArrayLike | None) – Passed to
TiffWriter.write()
.description (str | bytes | None) – Passed to
TiffWriter.write()
.datetime (str | bool | DateTime | None) – Passed to
TiffWriter.write()
.resolution (tuple[float | tuple[int, int], float | tuple[int, int]] | None) – Passed to
TiffWriter.write()
.resolutionunit (RESUNIT | int | str | None) – Passed to
TiffWriter.write()
.subfiletype (FILETYPE | int | None) – Passed to
TiffWriter.write()
.software (str | bytes | bool | None) – Passed to
TiffWriter.write()
.metadata (dict[str, Any] | None) – Passed to
TiffWriter.write()
.extratags (Sequence[TagTuple] | None) – Passed to
TiffWriter.write()
.maxworkers (int | None) – Passed to
TiffWriter.write()
.buffersize (int | None) – Passed to
TiffWriter.write()
.contiguous (bool) – Passed to
TiffWriter.write()
.truncate (bool) – Passed to
TiffWriter.write()
.align (int | None) – Passed to
TiffWriter.write()
.returnoffset (bool) – Return offset and number of bytes of memory-mappable image data in file.
- Returns:
If returnoffset is True and the image data in the file are memory-mappable, the offset and number of bytes of the image data in the file.
- Return type:
tuple[int, int] | None