Magick++ tiff loses compression

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
ths71
Posts: 2
Joined: 2014-03-06T14:43:55-07:00
Authentication code: 6789

Magick++ tiff loses compression

Post by ths71 »

on current IM 6.8.8.7, when you do

Code: Select all

image.read("group4.tif");
image.write("test.tif");
the resulting image is not compressed anymore.

if you insert

Code: Select all

image.compressType(image.compressType());
it has indeed the same compression as the source.

i traced this back to this change:
http://trac.imagemagick.org/changeset/1 ... ers/tiff.c
which in my opinion doesn't make any sense.

in

Code: Select all

    compression=UndefinedCompression;  
    if (image_info->compression != UndefinedCompression)  
      compression=image_info->compression;  
the first two lines are redundant, anyway.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Magick++ tiff loses compression

Post by fmw42 »

There was a decision made at that time to not pass on the compression, so as not to decompress and recompress, esp with JPG compression, and thus lose more quality.
susannamoore
Posts: 1
Joined: 2014-03-06T20:30:12-07:00
Authentication code: 6789

Re: Magick++ tiff loses compression

Post by susannamoore »

When it comes to TIFF, two main image compression options are available–they’re known as LZW or ZIP. Both ZIP and LZW are lossless compression methods. That means that no data is being lost in the image compression[/color][/url] process, unlike a lossy format like JPG. But there are two main reasons you might not to use ZIP or LZW compression. Because they require more processing to open and close them, compressed TIFF files can be a little slower to work with.
ths71
Posts: 2
Joined: 2014-03-06T14:43:55-07:00
Authentication code: 6789

Re: Magick++ tiff loses compression

Post by ths71 »

that's all well and good, but if you want to change compression, it's easy to do so. if you want to retain the settings of the original, not changing anything is the intuitive thing.

image.compressType(image.compressType());

is not a code that seems like it should do anything, but it does.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Magick++ tiff loses compression

Post by dlemstra »

I just committed a patch for this that only make sure that jpeg compression is not used when converting jpeg to tiff. The next release of ImageMagick (6.8.9-2) will include this fix.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply