MATLAB: How to control the compression rate when using IMWRITE with TIFF format in Image Processing toolbox 6.2 (R2009b)

Image Processing Toolbox

I want to control compression ratio when writing an image to TIFF format with JPEG compression scheme. I want to know if 'RowsPerStrip' or 'Resolution' parameter control the compression rate.

Best Answer

Function 'imwrite' uses LibTIFF library to write an image to TIFF format. The following LibTIFF documentation describes 'RowsPerStrip' and 'Resolution' parameters in details:
According to its documentation, TIFF supports breaking an image into separate strips for increased editing flexibility and efficient I/O buffering. The location and size of each strip is given by the 'RowsPerStrip' parameter. For example, if ImageLength is 24, and RowsPerStrip is 10, then there are 3 strips, with 10 rows in the first strip, 10 rows in the second strip, and 4 rows in the
third strip (The data in the last strip is not padded with 6 extra rows of dummy data). With JPEG compression scheme, this parameter must be a multiple of 8.
The 'Resolution' parameter determines the size of the picture represented by an image.
Therefore, neither parameter controls compression ratio nor compression ratio can be controlled directly. If you want more control over the quality of the compressed image, you would need to write the file as JPEG format instead of a TIFF and specify the 'Quality' parameter.