Image saving#
These are saving related functions that are usually called by :class:marsimage.MarsImage
Various functions to save images.
- marsimage.save.save_tiff(img, whitelevel, save_path, scale_factor=1.0, gamma: float = 1.0, dtype=<class 'numpy.uint16'>)[source]#
Write the image array as a tiff file.
The brightness will be normalize between 0 and the whitelevel. A gamma correction is applied if specified.
- Parameters:
img (ndarray) β The image array to save.
whitelevel (int) β The whitelevel of the image.
save_path (str | Path) β The path to save the image to.
scale_factor (float, optional) β The brightness scale factor to apply to the image. Default is 1.0.
gamma (float, optional) β The gamma correction to apply to the image. Default is 1.0.
dtype (numpy.dtype, optional) β The data type to save the image as. Default is np.uint16. Can be np.uint8 or np.uint16.
- Returns:
The path to the saved TIFF image.
- Return type:
Module that handles dng metadata and saving to the dng format.
- marsimage.dng.save_dng(marsimage, save_path, compress=False, pp3=False, rawtherapee_convert=False, remove_dng=False)[source]#
Save a marsimage object as a calibrated DNG file.
Optionally converts the DNG to a TIFF file using RawTherapee.
- Parameters:
marsimage (MarsImage) β The MarsImage object containing image data and metadata.
save_path (str | Path) β The path where the DNG file will be saved.
compress (bool, optional) β Whether to compress the DNG file lossless, by default False.
rawtherapee_convert (bool, optional) β Whether to convert the DNG to a TIFF file in place using RawTherapee, by default False. Ensure that the RAWTHERAPEE_CLI environment variable is set to the path of the RawTherapee CLI executable.
pp3 (bool, optional) β Whether to write a pp3 processing profile for RawTherapee, by default False.
remove_dng (bool, optional) β Whether to remove the DNG and pp3 file after conversion to TIFF, by default False
- Returns:
The path to the saved DNG file.
- Return type: