为了编辑tiff文件中的标签,我编写了以下代码,但源文件没有改变。
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);
此代码的输出是
new artist
但是当我重新打开文件并获取艺术家标签值时,它没有改变
TIFF *tif= TIFFOpen("new.tif", "r+");
void* val;
TIFFGetField (tif, TIFFTAG_ARTIST, &val);
cerr << (char*)val;
输出是:
127.90.112117