For editing tags in a tiff file, I wrote the below code but the source file did not change.
TIFF *tif= TIFFOpen("new.tif", "r+");
QString temp = "new artist";
TIFFSetField (tif, TIFFTAG_ARTIST, temp.c_str());
void* val;
TIFFGetField (tif, TIFFTAG_ARTIST, &val);
cerr << (char*)val;
TIFFFlushData(tif);
TIFFClose(tif);
The output of this code is
new artist
But when I reopen the file and get the artist tag value, it did not change
TIFF *tif= TIFFOpen("new.tif", "r+");
void* val;
TIFFGetField (tif, TIFFTAG_ARTIST, &val);
cerr << (char*)val;
output is:
127.90.112117