📄 tiffhdr.cpp
字号:
// TiffHdr.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include "TiffFile.h"
#include "Tiff.h"
#define PAUSE() \
{ \
putchar(getchar()); \
}
void print_error(TIFFStatus error)
{
printf("TIFF error %d occurred: %s\n", error, GetTiffErrorMsg(error));
}
int main(int argc, char* argv[])
{
CTiffFile *file;
CTiffPage *page;
CTiffTag *tag;
int i;
TIFFStatus ret;
file = new CTiffFile();
if ((ret = file->Open(argv[1])) != TIFF_OK) {
print_error(ret);
exit(1);
}
//
// FOR each page in the TIFF file:
//
for (i = 0; i < file->GetNumPages(); i++)
{
//
// Get a page from the file
//
page = file->GetPage(i);
//
// FOR each tag in the current IFD
//
int num_tags = page->GetNumTags();
for (int j = 0; j < num_tags; j++)
{
//
// Get the tag pointer by its index
// Print out the tag information
//
tag = page->GetTagByIndex(j);
tag->Print();
//
// ENDFOR
//
}
//
// Print out page stats
//
printf("Number of tags %d\n", page->GetNumTags());
printf("IFD base size %d\n", page->GetIFDBaseSize());
printf("IFD extended size %d\n", page->GetIFDExtendedSize());
//
// ENDFOR
// Close the file and delete the file object
//
}
if ((ret = file->Close()) != TIFF_OK) {
print_error(ret);
printf("Continuing...\n");
}
delete file;
//
// Pause before terminating
//
printf("All tests passed\n");
PAUSE();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -