Exif bug when reading TIFFs?

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?".
rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Exif bug when reading TIFFs?

Post by rnbc »

Hi!

While doing my "isolated pixel cleaning" (a solved problem now, many thanks!) I noticed that the EXIF information contained in the TIFF was lost in transit...

So that you can easily check out what seems like a bug I generated a small version of the TIFF using the same program (SilkyPix) and which suffers from the same problem.

Here it is, together with the converted version:

https://rnbc.dyndns.org/pub/imagemagick-exif-bug/

The conversion resulted from this command:

Code: Select all

convert small-landscape.tif'[0]' \( +clone -morphology HMT Peaks:1.5 \) +swap -compose subtract -composite -depth 8 -interlace line -quality 100 -sampling-factor 1x1 jpg:small-landscape-clean.jpeg
The TIFF actually contains 2 frames, because SilkyPix always includes a small preview frame, but I think that's not the issue...

PS: By the way: of course you can't see the hot pixels at this size... if you want the full size image just send me a message.

PPS: Sorry, I should have posted this to the bugs section, but it seems like I can't delete the post... anyone cares to move it?

User avatar
fmw42
Posts: 26268
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Exif bug when reading TIFFs?

Post by fmw42 »

I will defer to the IM developers, but I don't think this is a bug. It is a limitation of how smart IM can be when you do "destructive" processing on an image where more than one image is involved (counting your clones). I expect apart from some simple processing or just a copy, IM will not copy all the meta data to the output image. But the IM developers can correct me or explain in more detail.

rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: Exif bug when reading TIFFs?

Post by rnbc »

Not doing any processing results in two frames, both without exif. Try yourself:

Code: Select all

convert small-landscape.tif jpg:small-landscape2.jpg

rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: Exif bug when reading TIFFs?

Post by rnbc »

Also, running identify outputs no EXIF, although the information is there, at least for Windows (File->Properties) and PhotoShop...

Code: Select all

identify -verbose small-landscape.tif
Output:

Code: Select all

Image: small-landscape.tif
  Format: TIFF (Tagged Image File Format)
  Class: DirectClass
  Geometry: 300x200+0+0
  Resolution: 300x300
  Print size: 1x0.666667
  Units: PixelsPerInch
  Type: TrueColor
  Base type: TrueColor
  Endianess: MSB
  Colorspace: RGB
  Depth: 16-bit
  Channel depth:
    red: 16-bit
    green: 16-bit
    blue: 16-bit
  Channel statistics:
    Red:
      min: 2594 (0.0395819)
      max: 61786 (0.942794)
      mean: 30650.5 (0.467697)
      standard deviation: 11043.1 (0.168506)
      kurtosis: -0.267107
      skewness: -0.713083
    Green:
      min: 3308 (0.0504768)
      max: 57675 (0.880064)
      mean: 32856.4 (0.501356)
      standard deviation: 11776.7 (0.179701)
      kurtosis: -0.500753
      skewness: -0.702319
    Blue:
      min: 3508 (0.0535286)
      max: 52891 (0.807065)
      mean: 33041 (0.504173)
      standard deviation: 13427.5 (0.204891)
      kurtosis: -1.07481
      skewness: -0.557228
  Image statistics:
    Overall:
      min: 2594 (0.0395819)
      max: 61786 (0.942794)
      mean: 32182.6 (0.491075)
      standard deviation: 12123.5 (0.184993)
      kurtosis: -0.649095
      skewness: -0.612642
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 300x200+0+0
  Dispose: Undefined
  Iterations: 0
  Scene: 0 of 2
  Compression: None
  Orientation: TopLeft
  Properties:
    date:create: 2011-09-15T23:32:45+01:00
    date:modify: 2011-09-15T23:32:18+01:00
    signature: 488970f9e008574c32057de5abfcd7330a9ec5b7765c345af68e90b144e44149
    tiff:endian: lsb
    tiff:make: SIGMA
    tiff:model: SIGMA SD14
    tiff:photometric: RGB
    tiff:rows-per-strip: 1
    tiff:software: SILKYPIX(R) Developer Studio Pro 4.1.46.0
    tiff:timestamp: 2011:09:15 23:32:18
  Profiles:
    Profile-icc: 3140 bytes
      IEC 61966-2.1 Default RGB colour space - sRGB
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 439KBB
  Number pixels: 60KB
  Pixels per second: 20MB
  User time: 0.000u
  Elapsed time: 0:01.003
  Version: ImageMagick 6.7.0-10 2011-07-20 Q16 http://www.imagemagick.org
Image: small-landscape.tif
  Format: TIFF (Tagged Image File Format)
  Class: DirectClass
  Geometry: 160x120+0+0
  Resolution: 72x72
  Print size: 2.22222x1.66667
  Units: PixelsPerInch
  Type: TrueColor
  Base type: TrueColor
  Endianess: MSB
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Red:
      min: 0 (0)
      max: 218 (0.854902)
      mean: 106.653 (0.418246)
      standard deviation: 53.7585 (0.210818)
      kurtosis: -0.613004
      skewness: -0.72648
    Green:
      min: 0 (0)
      max: 211 (0.827451)
      mean: 114.283 (0.448169)
      standard deviation: 57.5217 (0.225575)
      kurtosis: -0.678506
      skewness: -0.715487
    Blue:
      min: 0 (0)
      max: 204 (0.8)
      mean: 114.541 (0.44918)
      standard deviation: 62.4493 (0.244899)
      kurtosis: -1.10962
      skewness: -0.500508
  Image statistics:
    Overall:
      min: 0 (0)
      max: 218 (0.854902)
      mean: 111.826 (0.438532)
      standard deviation: 58.0191 (0.227526)
      kurtosis: -0.807483
      skewness: -0.61396
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 160x120+0+0
  Dispose: Undefined
  Iterations: 0
  Scene: 1 of 2
  Compression: None
  Orientation: TopLeft
  Properties:
    date:create: 2011-09-15T23:32:45+01:00
    date:modify: 2011-09-15T23:32:18+01:00
    signature: 476c4ef40c228772dd20fdb32e30f0f49e6497d6451b87c6db05d3897592d228
    tiff:endian: lsb
    tiff:photometric: RGB
    tiff:rows-per-strip: 1
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 439KBB
  Number pixels: 19.2KB
  Pixels per second: 1.129MB
  User time: 0.016u
  Elapsed time: 0:01.017
  Version: ImageMagick 6.7.0-10 2011-07-20 Q16 http://www.imagemagick.org

User avatar
magick
Site Admin
Posts: 11217
Joined: 2003-05-31T11:32:55-07:00

Re: Exif bug when reading TIFFs?

Post by magick »

The libtiff delegate library supports the EXIF profile but it was unreliable and caused faults too often so we commented out the call. We will revisit EXIF within libtiff. Perhaps recent versions of libtiff has more robust support of EXIF.

rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: Exif bug when reading TIFFs?

Post by rnbc »

Perhaps you could make it a ./configure script option, when compiling ImageMagick?

User avatar
magick
Site Admin
Posts: 11217
Joined: 2003-05-31T11:32:55-07:00

Re: Exif bug when reading TIFFs?

Post by magick »

Try this:
  • identify -verbose -define tiff:exif=true small-landscape.tif
libtiff complains for the second image
  • identify: incorrect count for field "ImageUniqueID" (34, expecting 33); tag trimmed. `small-landscape.tif' @ warning/tiff.c/TIFFWarnings/710.
but get the EXIF attributes for the first:
  • Properties:
    date:create: 2011-09-15T20:07:03-04:00
    date:modify: 2011-09-15T19:40:44-04:00
    exif:CustomRendered: 1
    exif:DateTimeDigitized: 2011:09:10 21:12:00
    exif:DateTimeOriginal: 2011:09:10 21:12:00
    exif:ExposureBiasValue: 0
    exif:ExposureMode: 1
    exif:ExposureProgram: 1
    exif:ExposureTime: 30
    exif:Flash: 0
    exif:FNumber: 1.4
    exif:FocalLength: 30
    exif:FocalLengthIn35mmFilm: 52
    exif:ISOSpeedRatings: 1
    exif:LightSource: 0
    exif:MaxApertureValue: 1
    exif:MeteringMode: 2
    exif:SceneCaptureType: 0
    exif:SensingMethod: 2

rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: Exif bug when reading TIFFs?

Post by rnbc »

huh... over here:

Code: Select all

/usr/local/apps/ImageMagick/installed/bin/identify.exe -define tiff:exif=true -verbose small-landscape.tif
Produces no results at all... weird. Without the define it produces the results I wrote before.

ImageMagick-6.7.2-6 used here...

Seems like libtiff is broken :P

User avatar
magick
Site Admin
Posts: 11217
Joined: 2003-05-31T11:32:55-07:00

Re: Exif bug when reading TIFFs?

Post by magick »

The Windows version of ImageMagick has an older release of libtiff. We'll look into updating libtiff for the next point of ImageMagick.

rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: Exif bug when reading TIFFs?

Post by rnbc »

I actually compiled imagemagick under cygwin, so this is perhaps not your fault...

I'll try to install a newer version of libtiff... or just use imagemagick under Linux, which is how it should be used anyway ;)

rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: Exif bug when reading TIFFs?

Post by rnbc »

BTW, why isn't there an HDRI-enabled Q16 windows version? Since I need that, I have to compile my own version...

rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: Exif bug when reading TIFFs?

Post by rnbc »

In a Ubuntu 10.04 LTS the system libtiff segfaults when "-define tiff:exif=true" is used...

I can see the system libtiff is libtiff.so.4.3.2 but when I go to http://www.libtiff.org/ I see 3.6.1 listed as the latest version.

What's the recommended libtiff for ImageMagick?

rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: Exif bug when reading TIFFs?

Post by rnbc »

Ok... this gets weirder and weirder...

From wikipedia:
The primary libtiff website is considered hijacked. While it now contains a mirror of the real site for current development, the libtiff.org site has not been updated since version 3.6.1. Because of this, much of the information contained therein is incorrect, including the current version number, authors, mailing list address, and the CVS information.
Seems like the real site is http://www.remotesensing.org/libtiff/

Oh well... :lol:

User avatar
magick
Site Admin
Posts: 11217
Joined: 2003-05-31T11:32:55-07:00

Re: Exif bug when reading TIFFs?

Post by magick »

We have a patch to support EXIF in TIFF under Windows. Look for the patch in the next point release of ImageMagick.

rnbc
Posts: 109
Joined: 2010-04-11T18:27:46-07:00
Authentication code: 8675308

Re: Exif bug when reading TIFFs?

Post by rnbc »

Thanks! And in Linux? Or will ImageMagick support HDR in windows also? Sometimes I need HDR...

Should I just use the latest TIFF release and recompile in Linux, both the libtiff and ImageMagick?

PS: when I say Linux, I also say Cygwin... posix environments.

Post Reply