Any way to get arbitrary TIFF tags from a file?

It seems that there’s still no way to get all TIFF tags from a TIFF image, is that right? I've got these GeoTIFF images that have a handful of specialized TIFF tags in them. Calling CGImageSourceCopyPropertiesAtIndex(), I can see basic properties common to all TIFF images, like dimensions and color/pixel information, but no others.

Short of including libtiff, is there another way to get at the metadata? I've tried all of the options in CGImageSourceCopyAuxiliaryDataInfoAtIndex.

I've written a few bugs about this since 2020, all ignored.

Hello @JetForMe,

I'm happy to look into this further! Can you provide me with the following items:

  1. An image that contains a specialized TIFF tag.
  2. The Feedback IDs for the bug reports you filed.

Best regards,

Greg

Hi Greg, yes! FB8110522, FB9076636, and related: FB9076641.

My goal is to read digital elevation and other GIS data, which is often distributed as GeoTIFF files. GeoTIFF is a standard for a set of TIFF tags that provides information on how to interpret and georeference the data stored in the TIFF image data. As such, pixel value don't necessarily represent colors, but can represent any number of properties, chiefly altitude. I've needed to read files that were both 16-bit integer and 32-bit float values in meters.

The GeoTIFF tags provide information on how the 2D extent maps to lat/lon, and how the altitude values are to be interpreted relative to the geoid model of the earth (or whatever planet the data may be for).

These TIFF files are also sometimes BigTIFF (http://bigtiff.org/), for which I filed FB9076641, but I think macOS 14.5 supports BigTIFF.

The GeoTIFF standard (https://www.ogc.org/standard/geotiff/) specifies a half-dozen TIFF tags that contain within them a second set of ”geokeys.” This was done so avoid polluting the limited TIFF tags namespace. The current version of the standard: https://docs.ogc.org/is/19-008r4/19-008r4.html

I am unable to attach a file to this reply (both image and file attachment leave my files disabled in the open panel). Here is a link to a GeoTIFF file (although it is not BigTIFF): https://jetforme-org.sfo2.cdn.digitaloceanspaces.com/misc/posts/2024-07/test1.tiff

tiffdump for the above image:

% tiffdump 
Magic: 0x4949 <little-endian> Version: 0x2a <ClassicTIFF>
Directory 0: offset 8 (0x8) next 0 (0)
ImageWidth (256) SHORT (3) 1<10210>
ImageLength (257) SHORT (3) 1<4720>
BitsPerSample (258) SHORT (3) 1<32>
Compression (259) SHORT (3) 1<8>
Photometric (262) SHORT (3) 1<1>
SamplesPerPixel (277) SHORT (3) 1<1>
PlanarConfig (284) SHORT (3) 1<1>
Predictor (317) SHORT (3) 1<1>
TileWidth (322) SHORT (3) 1<512>
TileLength (323) SHORT (3) 1<512>
TileOffsets (324) LONG (4) 200<offsets>
TileByteCounts (325) LONG (4) 200<offsets>
SampleFormat (339) SHORT (3) 1<3>
33550 (0x830e) DOUBLE (12) 3<9.25926e-05 9.25926e-05 0>
33922 (0x8482) DOUBLE (12) 6<0 0 0 -119.106 34.1844 0>
34735 (0x87af) SHORT (3) 32<1 1 0 7 1024 0 1 2 1025 0 1 1 2048 0 1 4269 2049 34737 6 0 2054 0 1 9102 ...>
34736 (0x87b0) DOUBLE (12) 2<298.257 6.37814e+06>34737 (0x87b1) ASCII (2) 7<NAD83|\0>
GDALNoDataValue (42113) ASCII (2) 8<-999999\0>

Note the tags with IDs 33550, 33922, 34735, 34737, 34736, 34737. Those are the GeoTIFF tags.

Also note that I am not asking Apple to parse these tags, although that would be very nice. What I would like is for all TIFF tags and other TIFF metadata to be accessible (and ideally, writeable) via some macOS/iOS/visionOS API, in a generic way. That way we can all leverage the extensible nature of TIFF. Just give me the data inside the TIFF tag; I'll parse the GeoKeys.

(Note that this forum would not let me mark up links above. Wow, it also wouldn't let me include the integers for the tile offsets and byte counts in the dump above, saying there was inappropriate language in the post. I had to bisect it and update it multiple times to track down the specific language, as it would not say what it didn't like. Apparently it doesn't like strings of integers.)

It seems that there’s still no way to get all TIFF tags from a TIFF image, is that right?

It’s easy enough to do this yourself using libtiff and/or libgeotiff. You don’t need this to be in Apple’s image decoding APIs.

Note that this forum would not let me mark up links above. Wow, it also wouldn't let me include the integers for the tile offsets and byte counts in the dump above, saying there was inappropriate language in the post. I had to bisect it and update it multiple times to track down the specific language, as it would not say what it didn't like. Apparently it doesn't like strings of integers

Apparently strings of digits look like phone numbers and are rejected. I believe this is how they stop p r o s t i t u t e s from advertising on the forum.

As you can see, Apple have more important things to work on than GeoTIFF!

You might think that, but you‘d be wrong

I might think that, because I've done it.

Hey @JetForMe,

Thanks for providing those Feedback IDs!

These TIFF files are also sometimes BigTIFF (), for which I filed , but I think macOS 14.5 supports BigTIFF.

Indeed BigTIFF is now supported by Image I/O, but GeoTIFF tags are not. We have definitely received your request for this support though, thanks for filing that request!

Best regards,

Greg

Any way to get arbitrary TIFF tags from a file?
 
 
Q