Main Content

matlab.io.fits.imgCompress

Compress HDU from one file into another

Syntax

imgCompress(infptr,outfptr)

Description

imgCompress(infptr,outfptr) initializes the output HDU, copies all the keywords, and loops through the input image, compressing the data and writing the compressed data to the output HDU.

This function corresponds to the fits_img_compress function in the CFITSIO library C API.

Examples

import matlab.io.*
infptr = fits.openFile('tst0012.fits');
outfptr = fits.createFile('myfile.fits');
fits.setCompressionType(outfptr,'rice');
fits.imgCompress(infptr,outfptr);
fits.closeFile(infptr);
fits.closeFile(outfptr);