Search code examples
c++imagemetadatatiffrating

Can anyone clearify how to get tiff rating metadata in C++ or just the file rating the way Win Explore reads it?


Hey I'm completely lost when it comes to reading the tiff metadata in C++, I've looked over google and can't find any examples. All i want to do is read the rating property and output that to console i should be able to take it from there. thanks in advance.

UPDATE thanks folks I'll look more into the libtiff library

Looking into the libtiff folder it seems a bit overkill for what I'm trying to accomplish. Is it possible to read the "properties/details" tab of a file verse setting up the library or am I asking something extremely retarded. Again all i'm looking to find is a if there is a rating on he file or not.


Solution

  • Well, libtiff exposes all of this functionality, you just need to read the docs.

    To set metadata, you have TIFFSetField

    int
    TIFFSetField(TIFF* tif, ttag_t tag, ...)
    

    Likewise, to retrieve metadata you have TIFFGetField

    int
    TIFFGetField(TIFF* tif, ttag_t tag, ...)
    

    One thing to note here is if you are reading standard TIFF tags or proprietary tags. If they are proprietary and not in the libtiff library then someone has added them on their own, in which case you need their tag declarations to incorporate into your version of libtiff (or just get theirs). You can follow this guide if it comes to that (I've had to do it).