mogrify with comment removes compression (JPEG in TIFF)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
stefanherms
Posts: 1
Joined: 2015-11-02T04:12:02-07:00
Authentication code: 1151

mogrify with comment removes compression (JPEG in TIFF)

Post by stefanherms »

Hello everyone,

I'm new to ImageMagick so please forgive my lack of knowledge.
I have looked at the board but could not find a solution to my problem.
So maybe you could help me out.

I have taken over a project which uses ImageMagick.
Since it was an old version of ImageMagick we decided to update to a newer version.
The version we are using is 6.9.2.5 (Operation system is Windows). We have tried Q16, Q8, static, dynamic, x64 and x86 in every combination. All versions give the same result.

The old version (which we no longer use) worked fine. I cannot give you the version number since the pc was damaged and had to be reinstalled.
The new version however does not work as expected.
We want to add a comment to a tif image (compression JPEG).
We use the following command to achieve our goal:

Code: Select all

mogrify -comment SomeComment FileName
The command works fine and the comment is added. However the compression is lost.
So I get a 11Mb file while expecting a 180Kb file which is kind of uncool, since we add comment to quite a lot of files.

Adding a comment in the same way to a GroupFax4 compressed tiff file works fine. The compression is not removed.

I could add the following code to get the correct compression:

Code: Select all

mogrify -compress JPEG FileName
I get a file with about 500Kb. That is better regarding the size but still uncool since I just want to add a comment.

The older version added the comment without the loss of compression.

Want am I doing wrong? Is there some kind of global setting I have to activate or set?

Any help, hints or links will be appreciated.

Thanks in advance.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: mogrify with comment removes compression (JPEG in TIFF)

Post by fmw42 »

Try convert rather than mogrify for one image processing. But I suspect that IM has changed behavior over the years with regard to defaults, especially with TIFF. If you post one of your images, someone can check it out.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: mogrify with comment removes compression (JPEG in TIFF)

Post by snibgo »

When a tiff file compressed with jpeg was read then written to tiff, IM's default behaviour used to be to re-compress with jpeg. This caused data loss to the image, which is bad news for people who just wanted to add a comment. So the default behaviour was changed to not re-compress with jpeg.

If you jut want to change metadata such as adding a comment, a better solution is to use exiftool instead of IM.
snibgo's IM pages: im.snibgo.com
Post Reply