使用libtiff库读取tiff图片
冬瓜排骨汤 2014-07-15 06:10:35 代码很简单,如下:
1 #include <iostream>
2 #include "tiffio.h"
3
4 int main(int argc, char* argv[])
5 {
6 TIFF* tif = TIFFOpen(argv[1], "r");
7 if (tif)
8 {
9 int dircount = 0;
10 do
11 {
12 dircount++;
13 } while (TIFFReadDirectory(tif));
14 std::cout<<dircount<<" directories in "<<argv[1];
15 TIFFClose(tif);
16 }
17 std::cout<<std::endl;
18 return 0;
19 }
结果运行之后出错为:
TIFFReadDirectory: Warning, foo.tif: unknown field with tag 65001 (0xfde9) encountered.
TIFFReadDirectory: Warning, foo.tif: unknown field with tag 65002 (0xfdea) encountered.
TIFFReadDirectory: Warning, foo.tif: unknown field with tag 65003 (0xfdeb) encountered.
TIFFReadDirectory: Warning, foo.tif: unknown field with tag 65004 (0xfdec) encountered.
求大神指导。是图片损坏了还是程序有问题,还是别的什么?
感激不尽!