ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Schiaf on January 12, 2011, 10:41:08 AM

Title: Multipage TIFF
Post by: Schiaf on January 12, 2011, 10:41:08 AM
Hello,

I use exiftool to parse TIFF and I need to know is my TIFF is a Multi-Page TIFF or not. I haven't found a tag for this.

I would like to know if exiftool can give me this information or if it's possible to implement this option for exiftool.
I have found this perl code on the web, if it can help you.

Thanks a lot.
Title: Re: Multipage TIFF
Post by: Phil Harvey on January 12, 2011, 10:55:07 AM
There is no metadata value which stores this information, but it can easily be deduced by looking at a tag (such as ImageWidth for example) which should exist for all pages in a TIFF document:

exiftool -a -G1 -imagewidth FILE

Each IFD stores a separate page in the tiff image, and this command will effectively give you a list of IFD's containing images.  You can ignore SubIFD's if they exist, because they aren't separate pages.

- Phil
Title: Re: Multipage TIFF
Post by: marsie321 on January 23, 2021, 08:31:29 PM
Hello Phil,

thank for writing exiftool. It is besides imagemagick one of favorite tools.
I did not found a solution in the manpage/forum
a) how can access a page and extract the info from just one IFD e.g. as json.
magick DJI_0018.TIFF[23] json: # example to access only page 23

exiftool -v DJI_0018.TIFF
  + [IFD865 directory with 23 entries]
  | 0)  ImageWidth = 640
  | 1)  ImageHeight = 512
  | 2)  BitsPerSample = 16
  | 3)  Compression = 1
  | 4)  PhotometricInterpretation = 1
  | 5)  Make = DJI
  | 6)  Model = XT2
  | 7)  StripOffsets = 570068822
  | 8)  SamplesPerPixel = 1
  | 9)  RowsPerStrip = 512
  | 10) StripByteCounts = 655360
  | 11) XResolution = 1 (1/1)
  | 12) YResolution = 1 (1/1)
  | 13) PlanarConfiguration = 1
  | 14) ResolutionUnit = 1
  | 15) PageNumber = 865 0
  | 16) Software = V06.02.20
  | 17) SampleFormat = 1
  | 18) ApplicationNotes (SubDirectory) -->
  | + [XMP directory, 1349 bytes]
  | | AbsoluteAltitude = 620.253113
  | | RelativeAltitude = 49.900002
  | | GimbalRollDegree = 0.000000
  | | GimbalYawDegree = 20.500000
  | | GimbalPitchDegree = -89.900002
  | | FlightRollDegree = -1.300000
  | | FlightYawDegree = 15.700000
  | | FlightPitchDegree = -22.500000
  | | CamReverse = 0
  | | GimbalReverse = 0
  | | RtkFlag = 0
  | | TlinearGain = 0.40
  | | BandName = LWIR
  | | CentralWavelength = 10000
  | | WavelengthFWHM = 4500
  | 19) ExifOffset (SubDirectory) -->
  | + [ExifIFD directory with 9 entries]
  | | 0)  FNumber = 1.25 (1250/1000)
  | | 1)  DateTimeOriginal = 2021:01:20 14:27:08
  | | 2)  FocalLength = 19 (19/1)
  | | 3)  ImageNumber = 0
  | | 4)  SubSecTimeOriginal = 97
  | | 5)  FocalPlaneXResolution = 3.84 (3840/1000)
  | | 6)  FocalPlaneYResolution = 3.072 (3072/1000)
  | | 7)  FocalPlaneResolutionUnit = 4
  | | 8)  SensingMethod = 15
  | 20) GPSInfo (SubDirectory) -->
  | + [GPS directory with 7 entries]
  | | 0)  GPSLatitudeRef = N
  | | 1)  GPSLatitude = 48 4 32.983 (48/1 4/1 32983/1000)
  | | 2)  GPSLongitudeRef = E
  | | 3)  GPSLongitude = 11 38 28.966 (11/1 38/1 28966/1000)
  | | 4)  GPSAltitudeRef = 0
  | | 5)  GPSAltitude = 620.253 (620253/1000)
  | | 6)  GPSMapDatum = WGS-84
  | 21) CameraSerialNumber = 297589
  | 22) FrameRate = 30 (30/1)
  + [IFD866 directory with 23 entries]
Title: Re: Multipage TIFF
Post by: Phil Harvey on January 23, 2021, 08:38:29 PM
To extract all (for example) IFD6 information in JSON format:

exiftool -ifd6:all -a -json FILE > out.json

- Phil

P.S. I think you win the prize for resurrecting old threads.  This one was more than 10 years old.
Title: Re: Multipage TIFF
Post by: marsie321 on January 23, 2021, 09:23:56 PM
 ;) thanks for your help!

access to the page is possible, but how can extract "extras" SubDirectories (18, 19, 20, see below) and json is only listing "SourceFile".

# exiftool -ifd6:all -a DJI_0018.TIFF
Image Width                     : 640
Image Height                    : 512
Bits Per Sample                 : 16
Compression                     : Uncompressed
Photometric Interpretation      : BlackIsZero
Make                            : DJI
Camera Model Name               : XT2
Strip Offsets                   : 3995126
Samples Per Pixel               : 1
Rows Per Strip                  : 512
Strip Byte Counts               : 655360
X Resolution                    : 1
Y Resolution                    : 1
Planar Configuration            : Chunky
Resolution Unit                 : None
Page Number                     : 6 0
Software                        : V06.02.20
Sample Format                   : Unsigned
Camera Serial Number            : 297589
Frame Rate                      : 30

exiftool -ifd6:all -a -json DJI_0018.TIFF | tee test.json
[{
  "SourceFile": "DJI_0018.TIFF"
}]




  | 18) ApplicationNotes (SubDirectory) -->
  | + [XMP directory, 1349 bytes]
  | | AbsoluteAltitude = 620.353088
  | | RelativeAltitude = 50.000000
  | | GimbalRollDegree = 0.000000
  | | GimbalYawDegree = -82.599998
  | | GimbalPitchDegree = -90.000000
  | | FlightRollDegree = -0.400000
  | | FlightYawDegree = -55.700001
  | | FlightPitchDegree = 1.100000
  | | CamReverse = 0
  | | GimbalReverse = 0
  | | RtkFlag = 0
  | | TlinearGain = 0.40
  | | BandName = LWIR
  | | CentralWavelength = 10000
  | | WavelengthFWHM = 4500
  | 19) ExifOffset (SubDirectory) -->
  | + [ExifIFD directory with 9 entries]
  | | 0)  FNumber = 1.25 (1250/1000)
  | | 1)  DateTimeOriginal = 2021:01:20 14:26:40
  | | 2)  FocalLength = 19 (19/1)
  | | 3)  ImageNumber = 0
  | | 4)  SubSecTimeOriginal = 31
  | | 5)  FocalPlaneXResolution = 3.84 (3840/1000)
  | | 6)  FocalPlaneYResolution = 3.072 (3072/1000)
  | | 7)  FocalPlaneResolutionUnit = 4                                                                                                                                                                                                       
  | | 8)  SensingMethod = 15
  | 20) GPSInfo (SubDirectory) -->
  | + [GPS directory with 7 entries]
  | | 0)  GPSLatitudeRef = N
  | | 1)  GPSLatitude = 48 4 31.321 (48/1 4/1 31321/1000)
  | | 2)  GPSLongitudeRef = E
  | | 3)  GPSLongitude = 11 38 30.191 (11/1 38/1 30191/1000)
  | | 4)  GPSAltitudeRef = 0
  | | 5)  GPSAltitude = 620.353 (620353/1000)
  | | 6)  GPSMapDatum = WGS-84

Title: Re: Multipage TIFF
Post by: Phil Harvey on January 25, 2021, 07:40:06 AM
I see the problem:

            The -a option is implied if the -g or -G options are used,
            otherwise it is ignored and tags with identical JSON names
            are suppressed.

Add -G1 to your command to fix this.  I'll have to think about changing this.

- Phil

Edit: I'll change the behaviour to this in ExifTool 12.17:

            The -a option is implied when -json is used, but entries
            with identical JSON names are suppressed in the output.