I have a requirement to convert a pdf to a multi-page tiff, which is working great. But some reason the tiff always comes out with no compression. Below is the relevant code I believe.
Code: Select all
var settings = new MagickReadSettings()
{
Density = new Density(dpi,dpi),
Compression = CompressionMethod.Group4
};
using (var multiPageImage = new MagickImageCollection())
{
multiPageImage.Read(sourePath, settings);
using (var tiff = new MagickImageCollection())
{
foreach (var page in multiPageImage)
{
page.Threshold(new Percentage(80));
page.Depth = 1;
page.Format = MagickFormat.Tiff;
page.Settings.Compression = CompressionMethod.Group4;
tiff.Add(page);
}
tiff.Write(destinationPath);
}
}
The dpi is set to a default value, 300 I believe, and source and destination are passed in. It seems to work just fine, but I cannot figure out what is up with not being able to set the compression. It says it's set when you step through in the debugger, so i thought maybe there was something wrong with my installation of ghostscript. But I've seen the same thing happen on two other machines. So any insight or thoughts would be greatly appreciated.
Thanks