The following (simplified) C# code creates a multi page tiff file:
using System.Windows.Media.Imaging;
var tiffBitmapEncoder = new TiffBitmapEncoder();
using (var ms = new MemoryStream())
{
tiffBitmapEncoder.Compression = TiffCompressOption.Zip;
foreach (.....)
{
//Generate the image to add to tiff
.....
var bitmapSource = new BitmapImage(new Uri(.....));
tiffBitmapEncoder.Frames.Add(BitmapFrame.Create(bitmapSource));
}
tiffBitmapEncoder.Save(ms);
}
The compression seems to be done on each frame/bitmap individually. Therefore the file size grows linearly by the number of frames/bitmaps.
Is there a way to compress the tiff file as a whole?