Page 1 of 1

How to change tiff compression method in 7.2.0?

Posted: 2017-12-03T21:29:07-07:00
by 246246
There was a CompressionMethod property in MagickImage 7.1.0.
But in 7.2.0, it is not, instead it looks Compression property exists.
However it is read only.

Then, how to copy single page tiff file with changing compression method?
I had do it before like the following:

Code: Select all

MagickReadSettings settings = new MagickReadSettings();
settings.SetDefine(MagickFormat.Tif, "ignore-layers", true);
using (var image = new MagickImage(File.ReadAllBytes(srcPath), settings))
{
   image.Format = MagickFormat.Tif;
   image.CompressionMethod = CompressionMethod.NoCompression;
   image.Write(dstPath);
}
 
Best Wishes,

Re: How to change tiff compression method in 7.2.0?

Posted: 2017-12-03T22:04:04-07:00
by 246246
I just read https://www.imagemagick.org/discourse-s ... 22#p151883 .
So it shoud be:

Code: Select all

MagickReadSettings settings = new MagickReadSettings();
settings.SetDefine(MagickFormat.Tif, "ignore-layers", true);
settings.Compression = Compression.NoCompression;
using (var image = new MagickImage(File.ReadAllBytes(srcPath), settings))
{
        image.Format = MagickFormat.Tif;
        image.Write(dstPath);
}
RIght?

Re: How to change tiff compression method in 7.2.0?

Posted: 2017-12-04T13:07:44-07:00
by dlemstra
You should do the following:

Code: Select all

MagickReadSettings settings = new MagickReadSettings();
settings.SetDefine(MagickFormat.Tif, "ignore-layers", true);
using (var image = new MagickImage(File.ReadAllBytes(srcPath), settings))
{
   image.Format = MagickFormat.Tif;
   // You should set this property.
   image.Settings.CompressionMethod = CompressionMethod.NoCompression;
   image.Write(dstPath);
}

Re: How to change tiff compression method in 7.2.0?

Posted: 2017-12-07T19:12:23-07:00
by 246246
Thank you.
If I understand correctly, this shoule be

Code: Select all

image.Settings.Compression = Compression.NoCompression;
since version 7.2.0.

Re: How to change tiff compression method in 7.2.0?

Posted: 2017-12-08T00:17:37-07:00
by dlemstra
Yes that is correct.