我有一个包含多个图像的单个 tiff 文件。我想提取每个图像的图像描述值。我不知道为什么,但是当我使用 时ImageMetaDataReader
,它只返回第一个和最后一个图像描述。我已经使用 exiftool 验证了数据是否存在并转储到 xml 树。任何建议为什么这不起作用?
Metadata metadata = ImageMetadataReader.readMetadata(createInputFile());
for (Directory directory : metadata.getDirectories())
{
for (Tag tag : directory.getTags())
{
fileWriter.write(String.format(tag + "%n"));
}
}
使用元数据提取器的所有标签
[Exif IFD0] New Subfile Type - Full-resolution image
[Exif IFD0] Image Width - 1254 pixels
[Exif IFD0] Image Height - 558 pixels
[Exif IFD0] Bits Per Sample - 1 bits/component/pixel
[Exif IFD0] Compression - T6/Group 4 Fax
[Exif IFD0] Photometric Interpretation - WhiteIsZero
[Exif IFD0] Fill Order - Normal
[Exif IFD0] Image Description - 12345
[Exif IFD0] Strip Offsets - 399
[Exif IFD0] Orientation - Top, left side (Horizontal / normal)
[Exif IFD0] Samples Per Pixel - 1 samples/pixel
[Exif IFD0] Rows Per Strip - 558 rows/strip
[Exif IFD0] Strip Byte Counts - 7899 bytes
[Exif IFD0] Minimum Sample Value - 0
[Exif IFD0] Maximum Sample Value - 1
[Exif IFD0] X Resolution - 200 dots per inch
[Exif IFD0] Y Resolution - 200 dots per inch
[Exif IFD0] Planar Configuration - Chunky (contiguous for each subsampling pixel)
[Exif IFD0] Unknown tag (0x0125) - 0
[Exif IFD0] Resolution Unit - Inch
[Exif Thumbnail] New Subfile Type - Full-resolution image
[Exif Thumbnail] Image Width - 1253 pixels
[Exif Thumbnail] Image Height - 558 pixels
[Exif Thumbnail] Bits Per Sample - 1 bits/component/pixel
[Exif Thumbnail] Compression - T6/Group 4 Fax
[Exif Thumbnail] Photometric Interpretation - WhiteIsZero
[Exif Thumbnail] Fill Order - Normal
[Exif Thumbnail] Image Description - 12345
[Exif Thumbnail] Strip Offsets - 38596
[Exif Thumbnail] Orientation - Top, left side (Horizontal / normal)
[Exif Thumbnail] Samples Per Pixel - 1 samples/pixel
[Exif Thumbnail] Rows Per Strip - 558 rows/strip
[Exif Thumbnail] Strip Byte Counts - 1288 bytes
[Exif Thumbnail] Minimum Sample Value - 0
[Exif Thumbnail] Maximum Sample Value - 1
[Exif Thumbnail] X Resolution - 200 dots per inch
[Exif Thumbnail] Y Resolution - 200 dots per inch
[Exif Thumbnail] Planar Configuration - Chunky (contiguous for each subsampling pixel)
[Exif Thumbnail] Unknown tag (0x0125) - 0
[Exif Thumbnail] Resolution Unit - Inch
[File Type] Detected File Type Name - ARW
[File Type] Detected File Type Long Name - Sony Camera Raw
[File Type] Expected File Name Extension - arw
[File] File Name - test_images.tif
[File] File Size - 39884 bytes
[File] File Modified Date - Wed Apr 10 08:51:24 -02:30 2019
All tags using Exiftool.
ExifTool Version Number : 11.44
File Name : test_images.tif
Directory : .
File Size : 39 kB
File Modification Date/Time : 2019:04:10 08:51:24-02:30
File Access Date/Time : 2019:06:17 16:04:44-02:30
File Inode Change Date/Time : 2019:06:17 15:16:47-02:30
File Permissions : rwxr-xr-x
File Type : TIFF
File Type Extension : tif
MIME Type : image/tiff
Exif Byte Order : Little-endian (Intel, II)
Subfile Type : Full-resolution Image
Image Width : 1254
Image Height : 558
Bits Per Sample : 1
Compression : T6/Group 4 Fax
Photometric Interpretation : WhiteIsZero
Fill Order : Normal
Image Description : 12345
Strip Offsets : 399
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 558
Strip Byte Counts : 7899
Min Sample Value : 0
Max Sample Value : 1
X Resolution : 200
Y Resolution : 200
Planar Configuration : Chunky
T6 Options : (none)
Resolution Unit : inches
Subfile Type : Full-resolution Image
Image Width : 1253
Image Height : 558
Bits Per Sample : 1
Compression : T6/Group 4 Fax
Photometric Interpretation : WhiteIsZero
Fill Order : Normal
Image Description : 12345
Strip Offsets : 8689
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 558
Strip Byte Counts : 1288
Min Sample Value : 0
Max Sample Value : 1
X Resolution : 200
Y Resolution : 200
Planar Configuration : Chunky
T6 Options : (none)
Resolution Unit : inches
Subfile Type : Full-resolution Image
Image Width : 1254
Image Height : 558
Bits Per Sample : 1
Compression : T6/Group 4 Fax
Photometric Interpretation : WhiteIsZero
Fill Order : Normal
Image Description : 12345
Strip Offsets : 10368
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 558
Strip Byte Counts : 7899
Min Sample Value : 0
Max Sample Value : 1
X Resolution : 200
Y Resolution : 200
Planar Configuration : Chunky
T6 Options : (none)
Resolution Unit : inches
Subfile Type : Full-resolution Image
Image Width : 1253
Image Height : 558
Bits Per Sample : 1
Compression : T6/Group 4 Fax
Photometric Interpretation : WhiteIsZero
Fill Order : Normal
Image Description : 12345
Strip Offsets : 18658
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 558
Strip Byte Counts : 1288
Min Sample Value : 0
Max Sample Value : 1
X Resolution : 200
Y Resolution : 200
Planar Configuration : Chunky
T6 Options : (none)
Resolution Unit : inches
Subfile Type : Full-resolution Image
Image Width : 1254
Image Height : 558
Bits Per Sample : 1
Compression : T6/Group 4 Fax
Photometric Interpretation : WhiteIsZero
Fill Order : Normal
Image Description : 12345
Strip Offsets : 20337
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 558
Strip Byte Counts : 7899
Min Sample Value : 0
Max Sample Value : 1
X Resolution : 200
Y Resolution : 200
Planar Configuration : Chunky
T6 Options : (none)
Resolution Unit : inches
Subfile Type : Full-resolution Image
Image Width : 1253
Image Height : 558
Bits Per Sample : 1
Compression : T6/Group 4 Fax
Photometric Interpretation : WhiteIsZero
Fill Order : Normal
Image Description : 12345
Strip Offsets : 28627
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 558
Strip Byte Counts : 1288
Min Sample Value : 0
Max Sample Value : 1
X Resolution : 200
Y Resolution : 200
Planar Configuration : Chunky
T6 Options : (none)
Resolution Unit : inches
Subfile Type : Full-resolution Image
Image Width : 1254
Image Height : 558
Bits Per Sample : 1
Compression : T6/Group 4 Fax
Photometric Interpretation : WhiteIsZero
Fill Order : Normal
Image Description : 12345
Strip Offsets : 30306
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 558
Strip Byte Counts : 7899
Min Sample Value : 0
Max Sample Value : 1
X Resolution : 200
Y Resolution : 200
Planar Configuration : Chunky
T6 Options : (none)
Resolution Unit : inches
Subfile Type : Full-resolution Image
Image Width : 1253
Image Height : 558
Bits Per Sample : 1
Compression : T6/Group 4 Fax
Photometric Interpretation : WhiteIsZero
Fill Order : Normal
Image Description : 12345
Strip Offsets : 38596
Orientation : Horizontal (normal)
Samples Per Pixel : 1
Rows Per Strip : 558
Strip Byte Counts : 1288
Min Sample Value : 0
Max Sample Value : 1
X Resolution : 200
Y Resolution : 200
Planar Configuration : Chunky
T6 Options : (none)
Resolution Unit : inches
Image Size : 1254x558
Megapixels : 0.700