How to change tiff compression method in 7.2.0?

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
246246
Posts: 131
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

How to change tiff compression method in 7.2.0?

Post by 246246 » 2017-12-03T21:29:07-07:00

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,

246246
Posts: 131
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: How to change tiff compression method in 7.2.0?

Post by 246246 » 2017-12-03T22:04:04-07:00

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?

User avatar
dlemstra
Posts: 1412
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: How to change tiff compression method in 7.2.0?

Post by dlemstra » 2017-12-04T13:07:44-07:00

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);
}
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

246246
Posts: 131
Joined: 2015-07-06T07:38:22-07:00
Authentication code: 1151

Re: How to change tiff compression method in 7.2.0?

Post by 246246 » 2017-12-07T19:12:23-07:00

Thank you.
If I understand correctly, this shoule be

Code: Select all

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

User avatar
dlemstra
Posts: 1412
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: How to change tiff compression method in 7.2.0?

Post by dlemstra » 2017-12-08T00:17:37-07:00

Yes that is correct.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

Post Reply