Page 1 of 1

Pdf to Tiff image compression issue

Posted: 2018-09-24T11:29:17-07:00
by Terdledic
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

Re: Pdf to Tiff image compression issue

Posted: 2018-09-24T13:17:58-07:00
by dlemstra
Are you using the latest version of Magick.NET? A similar issues was solved in: https://github.com/dlemstra/Magick.NET/issues/307

Re: Pdf to Tiff image compression issue

Posted: 2018-09-25T06:30:17-07:00
by Terdledic
We were using the version linked to in the bug. I updated and it's working fine now. Thanks for the quick help.