Pdf to Tiff image compression issue

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Terdledic
Posts: 2
Joined: 2018-09-24T11:16:58-07:00
Authentication code: 1152

Pdf to Tiff image compression issue

Post 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
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Pdf to Tiff image compression issue

Post 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
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Terdledic
Posts: 2
Joined: 2018-09-24T11:16:58-07:00
Authentication code: 1152

Re: Pdf to Tiff image compression issue

Post 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.
Post Reply