slmsuite.holography.analysis.files.save_image#
- save_image(file_path, images, cmap=False, lut=None, normalize=True, border=None, **kwargs)[source]#
Save a grayscale image or stacks of grayscale images as a filetype supported by
imageio. Handlesmatplotlibcolormapping. Negative values are truncated to zero.np.nanvalues are set to transparent.- Parameters:
file_path (str) – Full path to the file to save the data in.
images (numpy.ndarray) – A 2D matrix (image formats) or stack of 2D matrices (video formats).
cmap (str OR bool OR None) – If
str, thematplotlibcolormap under this name is used. IfNoneorFalse, the images are directly saved as grayscale 8-bit images. IfTrue, the default colormap is used.lut (int OR None) – Size of the lookup table for the colormap. This determines the number of colors the resulting image has. This can be larger than 256 values because RGB data can realize more colors than grayscale. If
None`, Defaults to ``mpl.rcParams['image.lut'](if the image is floating point) or the maximum of the image (if the image )normalize (bool) – If
True, the maximum of the image is taken as the image maximum. IfFalseand using integer data, the data is unchanged. IfFalseand using floating point data, 1 is taken to be the maximum, and this is scaled to thelut.**kwargs – Passed to
imageio.imsave()orimageio.mimsave(). Useful for choosing apluginorformat.