convert uncompressed -> compressed tif loses metadata

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
Nick Payne
Posts: 2
Joined: 2013-11-27T11:54:50-07:00
Authentication code: 6789

convert uncompressed -> compressed tif loses metadata

Post by Nick Payne »

I use Silkypix to convert the raw files from my Fuji X-E1 to tif (in spite of it's abominable interface, it seems to produce the best raw conversion, but it will only save tif as uncompressed), and I then use convert to change the uncompressed tif files that Silkypix outputs to LZW compressed tif, which reduces the image sizes by about 50%. However, the conversion to compressed loses most of the image metadata - compared to the uncompressed file, the compressed tif is missing information for aperture, focal length, exposure, ISO setting, camera mode, program mode.

The command I'm using is:

Code: Select all

find . -maxdepth 1 -iname '*tif' -exec convert -compress lzw {} {} \;
and for each image it converts, I get the following series of warning/error messages:

Code: Select all

convert.im6: Incompatible type for "FileSource"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Incompatible type for "SceneType"; tag ignored. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Unknown field with tag 42034 (0xa432) encountered. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Unknown field with tag 42035 (0xa433) encountered. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Unknown field with tag 42036 (0xa434) encountered. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Unknown field with tag 42037 (0xa435) encountered. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/768.
convert.im6: Unknown field with tag 42240 (0xa500) encountered. `TIFFReadCustomDirectory' @ warning/tiff.c/TIFFWarnings/768.
OS is Ubuntu 13.10, and ImageMagick version information shows as:

Code: Select all

nick@nick-desktop:~$ convert --version
Version: ImageMagick 6.7.7-10 2013-09-10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
Is it possible to prevent the metadata being lost when converting to compressed tif?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert uncompressed -> compressed tif loses metadata

Post by fmw42 »

It is possible a more current version of IM may preserve those fields. Can you post a link to one of your images for others to test on more current versions of IM.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: convert uncompressed -> compressed tif loses metadata

Post by snibgo »

Recent versions of IM do strip aperture and other metadata.

I get around this by using the data from the original raw file. I could use exiftool to copy the data.
snibgo's IM pages: im.snibgo.com
Nick Payne
Posts: 2
Joined: 2013-11-27T11:54:50-07:00
Authentication code: 6789

Re: convert uncompressed -> compressed tif loses metadata

Post by Nick Payne »

snibgo wrote:Recent versions of IM do strip aperture and other metadata.
I get around this by using the data from the original raw file. I could use exiftool to copy the data.
Thanks. After your suggestion I had a look at exiftool, and I've setup the following script, which compresses the tif files and then uses exiftool to copy the metadata across from the original RAF files:

Code: Select all

#!/bin/sh
find . -maxdepth 1 -iname '*tif' -exec convert -compress lzw {} {} \;
exiftool -tagsfromfile %d%f.RAF -all:all -overwrite_original -ext tif .
Post Reply